Skip to main content

Performance

  • Normal React performance tips: React.memo, useMemo, useCallback etc.
  • Normalize large array state via createEntityAdapter API:
    • Use Ids array as minimal core data (other than whole Data[]).
    • Fast element lookup in normalized state (other than slow Array.find()).
  • Create memorized selectors via createSelector API.

Code Splitting

Pitfalls

  • All reducers are called to produce the next store state.
  • All mapStateToProps/useSelectors of mounted components are called.
  • As every mapStateToProps/useSelector that returned a different reference from the previous render, the associated components are rendered (re-rendering problem).