Skip to content

[SSG] Hydrate problem when the different variables #1457

Answered by kitten
nghiepdev asked this question in Q&A
Discussion options

You must be logged in to vote

The hook always exposes previous data while it's loading new data. The code example you've shown here also doesn't really reflect the state of the hook. A result contains more properties apart from data that needs to be kept track off.

Also, if you're in need of keeping track of changing data, it may also be worth to have your own useState hook with either a useEffect or an inline if statement that stores the state as it changes.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nghiepdev
Comment options

@JoviDeCroock
Comment options

@nghiepdev
Comment options

Answer selected by nghiepdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants