Skip to content

$ is not defined #65032

Answered by icyJoseph
lovelyJason asked this question in Help
Apr 25, 2024 · 1 comments · 10 replies
Discussion options

You must be logged in to vote

Yes that the issue then, those unchecked references to $, which is not available in the global scope of SSR

The reason why useLayoutEffect exists, is to do work on the DOM, imperatively, before the browser paints, so that you don't show the UI before doing the modifications you need.

useEffect can also see the DOM already, but then React has already yielded so that the browser can paint. Whether or not to use either, is almost a matter of business logic, is it ok for users to see the DOM before you go and do modifications to it? You might not see them now, but in production, in slower devices, or with other things happening in your application, it is possible to see this flashes of content.

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@lovelyJason
Comment options

@lovelyJason
Comment options

@lovelyJason
Comment options

@icyJoseph
Comment options

Answer selected by lovelyJason
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants