Redux Application Structure
To recap from the previous chapter, we can set up a basic application using the following command: npx create-react-app my-app --template redux.
Our focus here is the src folder since the public folder has no significant change. In the src folder, we will see many files and folders however following are the ones to be taken into consideration before we go on to understanding the remaining parts:
srcappstore.js
featurescountercounter.jscounterSlice.js
index.jsApp.js
Following are the files found in it:
- The
appfolder always contains astore.jsfile, which contains the code for creating the Redux store; - The
featuresfolder is unnecessary though it helps organize all the feature-focused components and their reducers. Thecounter.jsfile contains theCountercomponent, and thecounterSlice.jscontains the reducer, which is supposed to handle the state changes of theCountercomponent; index.jsis the entry point of the application, this is executed first when the application starts;App.jscontains the top-level componentApp.
Here is the codesandbox with the application. Tap the top left three lines to access other files.
Дякуємо за ваш відгук!
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Запитайте мені питання про цей предмет
Сумаризуйте цей розділ
Покажіть реальні приклади
Awesome!
Completion rate improved to 3.45
Redux Application Structure
Свайпніть щоб показати меню
To recap from the previous chapter, we can set up a basic application using the following command: npx create-react-app my-app --template redux.
Our focus here is the src folder since the public folder has no significant change. In the src folder, we will see many files and folders however following are the ones to be taken into consideration before we go on to understanding the remaining parts:
srcappstore.js
featurescountercounter.jscounterSlice.js
index.jsApp.js
Following are the files found in it:
- The
appfolder always contains astore.jsfile, which contains the code for creating the Redux store; - The
featuresfolder is unnecessary though it helps organize all the feature-focused components and their reducers. Thecounter.jsfile contains theCountercomponent, and thecounterSlice.jscontains the reducer, which is supposed to handle the state changes of theCountercomponent; index.jsis the entry point of the application, this is executed first when the application starts;App.jscontains the top-level componentApp.
Here is the codesandbox with the application. Tap the top left three lines to access other files.
Дякуємо за ваш відгук!