Challenge: Installing Redux Toolkit
In this exercise, you will learn how to install Redux Toolkit and its required dependencies in a new React project.
Prerequisites
Before proceeding, please ensure you have installed Node.js and NPM on your computer. You can verify this by checking their versions. If you see version numbers, then you can proceed with the task. If not, please refer to the official Node.js documentation to install them on your machine.
pythonnode -vnpm -v
Task
Step 1: Create a New React Project
Open your terminal. Create a new React project using Create React App. Run the following command:
pythonnpx create-react-app my-redux-app
Navigate to your project directory:
pythoncd my-redux-app
Step 2: Install Redux Toolkit and Dependencies
In your project directory, run the following command to install Redux Toolkit:
pythonnpm install @reduxjs/toolkit
Redux Toolkit may require additional dependencies. Install them using the following command:
pythonnpm install react-redux
Step 3: Verify the Installation
- Open your code editor and navigate to the project directory of your React app;
- Check the
package.json
file in the root directory to ensure that the necessary dependencies are listed; - You should see entries for
@reduxjs/toolkit
andreact-redux
under thedependencies
section.
Step 4: Start the Development Server
- Return to your terminal;
- Start the development server by running:
pythonnpm start
Open your web browser and go to http://localhost:3000
. You should see your React application running.
Thanks for your feedback!