Connecting Components to the Store
Learn to connect components to the store.
We'll cover the following
In this section, we are going to connect the existing components in our app to our store. We will start by adding what is called a store provider to the root of our component tree, which allows components lower in the tree to consume the store. We will then connect the home, question, and search pages to the Redux store using hooks from React Redux.
Adding a store provider
Let’s provide the store to the root of our component tree. To do that, perform the following steps:
In
App.tsx
, import theProvider
component from React Redux and theconfigureStore
function we created in the previous section. Add theseimport
statements just after the Reactimport
statement:
Get hands-on with 1400+ tech skills courses.