Balancing Global Information and Synchronization
Learn about the versatility of the useRef hook in React.
Optimizing global data sync
When we design a web application, we tend not to have a global variable, because we know it's so easy that their usage can lead to some unmanageable side effects. On the other hand, if we have some global information that is valid for the entire site, it's still handy if we want to share it with the rest of the app behind the scenes. So, what kind of compromise can we have in this situation?
When we create a context to share info for a site. We can provide the information at the very top of the tree, the App
component:
Get hands-on with 1400+ tech skills courses.