Redux performance - fantasy0107/notes GitHub Wiki
Redux
Redux ruins your React app performance? You are doing something wrong
Tips and tricks
- Make components smaller
將每個 component 變成 connected components 從 redux 讀取需要的數值
- Reduce data scope
例如需要 render collection(ex:Flatlist), 不要將所有資料丟進來而是只丟 itemIds 再利用 小元件 根據 id 去讀 redux 需要的資料(title, foo, bar ...)
- Double check yourself ?
確定你的 memoization works
其它
Do I have to deep-clone my state in a reducer? Isn't copying my state going to be slow?
deep cloning state creates new references for every field. Since the React-Redux connect function relies on reference comparisons to determine if data has changed, this means that UI components will be forced to re-render unnecessarily even though the other data hasn't meaningfully changed.