useProxy and useLayoutEffect #652
juliancwirko
started this conversation in
General
Replies: 1 comment 10 replies
-
useEffect is no-op on server. And, it's very hard to detect if we are on sever. import { snapshot } from 'valtio'
import { useProxy as useProxyOrig } from 'valtio/utils'
const isSSR = typeof window === 'undefined' // this is usually not enough
export const useProxy = isSSR ? (p) => snapshot(p) : useProxyOrig |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm getting a warning regarding useEffectLayout and SSR on the server side in Next.js (the newest version). Are there any drawbacks to something like this?
Beta Was this translation helpful? Give feedback.
All reactions