MCPcopy Create free account
hub / github.com/adobe/react-spectrum / NavigationSuspense

Function NavigationSuspense

packages/dev/s2-docs/src/Router.tsx:95–106  ·  view source on GitHub ↗
({children}: {children: React.ReactNode})

Source from the content-addressed store, hash-verified

93}
94
95export function NavigationSuspense({children}: {children: React.ReactNode}) {
96 let {isLoading} = useContext(RouterContext)!;
97
98 useLayoutEffect(() => {
99 // Scroll to the top when we show the skeleton on mobile.
100 if (isLoading) {
101 window.scrollTo({top: 0});
102 }
103 }, [isLoading]);
104
105 return isLoading ? <PageSkeleton /> : children;
106}
107
108interface RouterContextValue {
109 currentPage: Page;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected