Using the Context

Refactor the React code to use context in this lesson.

In React, we use a context by making a JSX element called a provider. We can see our provider in the returned JSX at the end of the file. We create a JSX element called VenueContext.Provider and place our existing Venue component inside it. We pass one prop to the provider, called value, which is an object with {state, dispatch}. That object syntax defines an object where the key and value have the same name. In other words, the object being passed to the prop is {state: state, dispatch: dispatch} ...