Sharing State - Venue Component
Explore how to manage and share state between parent and child React components in a Rails application. Understand the lifting state up pattern to handle seat selection and tickets-to-buy state in a venue component for dynamic user interactions.
We'll cover the following...
We'll cover the following...
Lifting state up and passing state down
Hooks and useState work very cleanly when the state is completely encapsulated inside one component, but often components have to share state. Sometimes state is shared among just one subtree of DOM elements on the page, but sometimes state is shared across a page. I’ll talk more about this in Managing State in React, but I did want to cover the simplest version of one common scenario, where state is shared among parent and child components. ...