Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating the Redux Store | Redux in Practice
Introduction to Redux
course content

Contenido del Curso

Introduction to Redux

Introduction to Redux

1. Getting Started
2. Fundamental Concepts
3. Redux in Practice
4. Creating a React-Redux Application

bookCreating the Redux Store

In the previous chapter, we deleted some files to create an empty structure we can use to build our application. In this chapter, we will build on top of that empty template.

We deleted a file called store.js, which contained the code for creating the Redux store. We will create our own Redux store based on the requirements of our application.

We will set up a Redux Store for a simple Todo application. For reference, this was the code from the store.js, which we deleted:

A Redux Store is created using the configureStore function, which is imported from the Redux Toolkit:

To recap, a reducer is a function responsible for handling a dispatched action and modifying the state based on that. A Redux store needs one or more reducers since reducers are the main method of modifying the application state based on an event.

In the above code, after importing a reducer from the counterSlice as counterReducer, we assigned it to the key counter inside the reducer object.

Each feature in a Redux application might have a reducer for handling events. We can pass more reducers into the store by adding more keys to the reducer object:

Select the correct option for creating a Redux store using the todosReducer and name it `todos`.

Select the correct option for creating a Redux store using the todosReducer and name it todos.

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 3
We're sorry to hear that something went wrong. What happened?
some-alt