Open2

Micro State Management with React Hooks を読む

kappazkappaz

Lift content up
With complex component trees, we may have a component that doesn't depend on the state we are lifting up.
To avoid extra re-renders, we can lift up content. In this case, Parent re-renders with count, hence, we create GrandParent, as follows:

子コンポーネントにおける不要な再レンダーを抑制するために、props(children)としてコンポーネントを与えるという方法があるようだ。
これは普通に知らなかった。childrenはpropsとして渡されるもので、レンダリング自体は渡された先のコンポーネント内で起きるものではない。結果、childrenを受け取ったコンポーネントが更新されてもchildren自体の再レンダーは起きない。

いや言われると確かにその通りだが、思い至らなかったな...