DEV Community

Discussion on: useContext for better state management!

Collapse
 
luubinhan profile image
Lưu Bình An

You get into the issue with re-render soon, believed me I try to useContext as you mention, then the nightmere visit me when I do think complex

  • it is not designed for frequent updates
  • async operations are tricky
  • it has performance limitations
  • does not support selectors
  • you cannot prevent re-renders
  • correctly handling provider-less context is hard
Collapse
 
ratneshmurugesan profile image
Ratnesh Murugesan • Edited

Which alternate concept are you preferring / using nowadays?

Collapse
 
luubinhan profile image
Lưu Bình An
Thread Thread
 
zaghadon profile image
David Nzagha

This is literally the best stuff I saw here, gracias 🙌

Collapse
 
frankgo81 profile image
FRANK GO

agree. for complex projects with complex frontend UX it is difficult and in-efficient for context

Collapse
 
veercodeprog profile image
Veer Pratap

does that mean we should avoid using useContext.

Collapse
 
luubinhan profile image
Lưu Bình An

I think there some use case that a good fit for useContext, for example you have some data that readonly between multiple components.

Thread Thread
 
veercodeprog profile image
Veer Pratap

I want to use it for sessionmanger to pass user object in body tag.

Thread Thread
 
veercodeprog profile image
Veer Pratap

stackoverflow.com/questions/763610...
Can you help me out with this