
Sign up to save your podcasts
Or
Whilst using remix I realized even after naming a file .client.ts and importing it into the remix page, it does not affect how remix generates html on the server. As an SSR framework it always generates the html on the server and so accessing the window becomes undefined. The solution to that is to run the code in useEffect. I was wondering if there are ways around that instead of having to throw in a bunch of useEffect to solve that. Next.JS has next/dynamic import which can be used and also by setting { ssr: false } , I don't have to worry about window being undefined.
Thanks
Remix: ways around window undefined
5
22 ratings
Whilst using remix I realized even after naming a file .client.ts and importing it into the remix page, it does not affect how remix generates html on the server. As an SSR framework it always generates the html on the server and so accessing the window becomes undefined. The solution to that is to run the code in useEffect. I was wondering if there are ways around that instead of having to throw in a bunch of useEffect to solve that. Next.JS has next/dynamic import which can be used and also by setting { ssr: false } , I don't have to worry about window being undefined.
Thanks
Remix: ways around window undefined
285 Listeners
629 Listeners
275 Listeners
111,160 Listeners
989 Listeners
58 Listeners
27 Listeners
15 Listeners