Chapter 8 · 7 examples

React Context and performance

The problem · How Context can help · Context value change · Preventing unnecessary Context re-renders: split providers · Reducers and split providers · Context selectors

  1. Example 1Lifting state up
  2. Example 2Passing state through Context
  3. Example 3Provider re-render problem
  4. Example 4Memoizing the value
  5. Example 5Splitting providers
  6. Example 6Reducers and stable API
  7. Example 7Context selectors via HOC