Design Patterns · Senior · Question 20 of 75
What's wrong with a "God Context" - one React Context holding all of the app's state?
- ✓Correct answer: Any change wakes up every consumer
- 2A Context can't hold more than 100 fields
- 3Such a context can't be used in Server Components
Explanation
Changing the theme re-renders the cart, and typing in the search form re-renders the whole catalog. Besides, all modules become coupled through one object. Split the context by domain and change frequency, or use a store with selectors.