setState
Warning: Cannot update a component (
ChatNotificationsProvider) while rendering a different component (Navbar). To locate the bad setState() call inside Navbar and the same goes to the NotificationsProvider when i try to set state to the context and i dont understand how to prevent this error
4 Replies
quickest-silver•2y ago
Don’t use
setState inside renderequal-aquaOP•2y ago
so how can i assign notifications to my context if i dont use setState
quickest-silver•2y ago
I think your architecture is skewed. A custom context for notifications is a red flag to me.
To answer your question: useEffect
equal-aquaOP•2y ago
lol chill bro im still learning how can i handle notifications if not using context from react?
i know there is zustand or sth like that
i need to have them stored somewhere