Reduxはディスパッチの度にすべてのミドルウェアを実行し、すべてのコンポーネントに対してループしてmapsStateToPropsを実行する
#パフォーマンス #Redux
from React at 60fps: improving scrolling comments in Figma
We started investigating why the other components were re-rendering when viewport information in the Redux store changed. We found that Redux runs every single middleware and loops through and runs mapsStateToProps for every connected component, each time an action is dispatched. It then passes all of the data down through multiple layers to the comments view. But in our case, the only thing that should need this is the comments view. We had instances where we were passing in anonymous functions to force the components to render over and over again.
私たちは、Reduxストアのビューポート情報が変更されたときに、他のコンポーネントが再レンダリングする理由を調査し始めました。Reduxは、アクションがディスパッチされるたびに、すべてのミドルウェアを実行し、接続されているすべてのコンポーネントに対してループしてmapsStateToPropsを実行していることがわかりました。そして、すべてのデータを複数のレイヤーを通してコメントビューに渡します。しかし、私たちの場合、これを必要とするのはコメントビューだけです。私たちは、無名関数を渡してコンポーネントを何度もレンダリングさせていたことがあります。
#Action
#差分レンダリング