Design Patterns · Senior · Question 20 of 75

What's wrong with a "God Context" - one React Context holding all of the app's state?

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.

Further reading

Problem with a question

Design Patterns · Senior · question 20

Test yourself

Take the Design Patterns · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz