Next.js Discord

Discord Forum

How to re-render all children to Show updated values.

Answered
Munchkin posted this in #help-forum
Open in Discord
Original message was deleted.
Answered by Silver Marten
i don't fully understand your question but i think useContext() might be the answer to this

https://react.dev/reference/react/useContext
React automatically re-renders all the children that use a particular context starting from the provider that receives a different value. The previous and the next values are compared with the Object.is comparison. Skipping re-renders with memo does not prevent the children receiving fresh context values.
View full answer

5 Replies

Munchkin
bump
Munchkin
Could Middleware be the answer in this case?
Original message was deleted
Silver Marten
i don't fully understand your question but i think useContext() might be the answer to this

https://react.dev/reference/react/useContext
React automatically re-renders all the children that use a particular context starting from the provider that receives a different value. The previous and the next values are compared with the Object.is comparison. Skipping re-renders with memo does not prevent the children receiving fresh context values.
Answer