DEV Community

Discussion on: Getting started with state management using useReducer and Context

anderspk profile image

Nice article!
Just a question though, because in most tutorials I see using context, the app is so small that the direct children of the entire app use context. I was wondering, in a larger app, should the Provider always be at the top in app.js, or only in the parent of the children that require the state?

emma profile image
Emma Goto 🍙 Author

Good question! The context doesn't need to be at the top of the app, you can put it anywhere where it's needed.