Learned Redux Basics

Learned Redux Basics
calendar
13 Sep 2024
tags
Javascript
Redux
reactjs

I have learned some basics of Redux by contributing in adding dark mode functionality into a YouTube clone project from a GitHub user.

Redux

- global state in obj tree inside a single store

- create an action to change the state

- dispatch using the store

- use reducer functions to get the new state

Example:

Step 1: Create slice file for setting up states

Step 2: Include the slicer into the store

Step 3: Wrap the App component with Provider

Step 4: Create a button component for dispatching the state update

Step 5: Use the state value provided by the store