`ClientOnly` fallback
I found this code for a client that only runs on the clientbut how can I get it to render a fallback?
3 Replies
you can modify the implementation like this:
or use
isHydrated
from solid-primitives to do this anywhere:
https://primitives.solidjs.community/package/lifecycle#ishydrated
you may want to combine clientonly
with lazy
and Suspense
for code splitting toooo
isHydrated()
is cool, thanks
what advantages does code splitting have in this context?if some code is client-only than it's probably not critical enough to be loaded as soon as possible
so code splitting will let the main bundle be downloaded and executed faster