DEV Community

Discussion on: Using the React Context API, the right way (a time saver)

Collapse
 
hyggedev profile image
Chris Hansen

Hey great article D: So just to clarify, Context is not for state management, as you can handle state anyway you like, but the ContextProvider allows you to have access to that data anywhere without prop drilling? Is my mind in the right place? I know how to use it, I just hope I know WHY I'm using it LOL. Thanks ahead.

Collapse
 
ncpa0cpl profile image
ncpa0cpl

You are correct, except Context Provider does not allow to have access to that data anywhere. It's only within React Components that are descendants of that Provider.

What's most important Context does not give any option to access it's data outside the React tree (Redux and other State Management library do)

Thread Thread
 
hyggedev profile image
Chris Hansen

Ahh okay gotcha. Perfectly said, I get it now. Thanks! 👌