File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
packages/plugin-rsc/examples/basic/src/routes/browser-only Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -37,25 +37,25 @@ const useHydrated = () =>
3737/*
3838If we were to implement this whole logic via `browserOnly` helper with transform:
3939
40- [ input]
40+ ======= input ======
4141
42- const SomeDep = browserOnly(() => import('./some-dep'))
42+ const SomeDep = browserOnly(() => import('./some-dep'))
4343
44- [ output]
44+ ======= output ======
4545
46- const __TmpLazy = import.meta.env.SSR ? undefined : React.lazy(() => import('./some-dep'}));
46+ const __TmpLazy = import.meta.env.SSR ? undefined : React.lazy(() => import('./some-dep'}));
4747
48- const SomeDep = ({ browserOnlyFallback, ...props }) => {
49- const hydrated = useHydrated()
50- if (!hydrated) {
51- return browserOnlyFallback
52- }
53- return (
54- <React.Suspense fallback={browserOnlyFallback}>
55- <__TmpLazy {...props} />
56- </React.Suspense>
57- )
48+ const SomeDep = ({ browserOnlyFallback, ...props }) => {
49+ const hydrated = useHydrated()
50+ if (!hydrated) {
51+ return browserOnlyFallback
5852 }
53+ return (
54+ <React.Suspense fallback={browserOnlyFallback}>
55+ <__TmpLazy {...props} />
56+ </React.Suspense>
57+ )
58+ }
5959*/
6060
6161// declare function browserOnly<T>(fn: () => Promise<{ default: React.ComponentType<T> }>): React.ComponentType<T & { browserOnlyFallback?: React.ReactNode }>
You can’t perform that action at this time.
0 commit comments