'is usContext a reliable solution to drill state 2-3 level deep
I have a search component which needs to pass the state in which the visibility of my search modal is stored down 2-3 levels. I know that context is provided to prevent prop drilling but, performance-wise, is it a good solution? My main concern is that there is no selector in context and if I update the context, it will update its value completely. Considering the fact that only the components that have useContext will re-render does it win the trade-off between prop drilling and performance?
In addition, I found some rough implementation of selector for context but under the hood they don't make any big differences.
Thanks for your thoughts and ideas in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|