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

Kurssisisältö

Introduction to Redux

Introduction to Redux

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

book
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:

  • src

    • app

      • store.js

  • features

    • counter

      • counter.js

      • counterSlice.js

  • index.js

  • App.js

Following are the files found in it:

  • The app folder always contains a store.js file, which contains the code for creating the Redux store;

  • The features folder is unnecessary though it helps organize all the feature-focused components and their reducers. The counter.js file contains the Counter component, and the counterSlice.js contains the reducer, which is supposed to handle the state changes of the Counter component;

  • index.js is the entry point of the application, this is executed first when the application starts;

  • App.js contains the top-level component App .

Here is the codesandbox with the application. Tap the top left three lines to access other files.

question mark

What is the purpose of the store.js file?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 1

Kysy tekoälyä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

course content

Kurssisisältö

Introduction to Redux

Introduction to Redux

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

book
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:

  • src

    • app

      • store.js

  • features

    • counter

      • counter.js

      • counterSlice.js

  • index.js

  • App.js

Following are the files found in it:

  • The app folder always contains a store.js file, which contains the code for creating the Redux store;

  • The features folder is unnecessary though it helps organize all the feature-focused components and their reducers. The counter.js file contains the Counter component, and the counterSlice.js contains the reducer, which is supposed to handle the state changes of the Counter component;

  • index.js is the entry point of the application, this is executed first when the application starts;

  • App.js contains the top-level component App .

Here is the codesandbox with the application. Tap the top left three lines to access other files.

question mark

What is the purpose of the store.js file?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 1
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt