2021年5月1日星期六

is using react context in more places, more costy?

<SuperComponent>    <ChildComponent />    <ChildComponent />  </SuperComponent>  

Assuming we have an context controlled by a reducer, and it's an object that contains needed data for all ChildComponents. And let's assume instead of 2 children, we have like 10-15 children.

Is it better to call useContext once in SuperComponent then pass the needed data to children as props, or call useContext in each ChildComponent individually?

https://stackoverflow.com/questions/67352572/is-using-react-context-in-more-places-more-costy May 02, 2021 at 10:51AM

没有评论:

发表评论