Discover this podcast and so much more

Podcasts are free to enjoy without a subscription. We also offer ebooks, audiobooks, and so much more for just $11.99/month.

Remix: ways around window undefined

Remix: ways around window undefined

FromThe Call Kent Podcast


Remix: ways around window undefined

FromThe Call Kent Podcast

ratings:
Length:
6 minutes
Released:
Sep 13, 2022
Format:
Podcast episode

Description

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
Released:
Sep 13, 2022
Format:
Podcast episode

Titles in the series (100)

The Call Kent podcast is a regular podcast where you call in with a question and Kent answers. Call in with your questions right from your web browser with any device at https://kentcdodds.com/call