Search⌘ K
AI Features

Structuring the Code

Explore how to structure Redux projects by organizing code into directories for actions and reducers, creating action creators, reducers, and configuring the store. Understand how this approach leads to maintainable and scalable state management.

We'll cover the following...

Having all our code in a single file is a bad idea. In Redux, it’s common for the directory structure to follow the names of the Redux “actors.” Reducers are placed in the reducers directory in the root.js file along with the main reducer (commonly called the root reducer). Action creators go in the actions directory, divided by the type of object or data they handle. Our action creators are actions/recipes.js and actions/ingredients.js.

Actions

First, we will create the actions directory. Inside of it, we will place two files: recipes.js and ingredients.js. They ...