From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Introduction to Redux

Introduction to Redux

Hello and welcome to lesson number four. In this lesson, we are going to kickstart our advanced state management libraries and we are going to start with introduction to Redux. Let's continue with the core principles of Redux. Number one is the single source of truth. So we want to avoid props drilling and we can't be passing props to every other component which can have their own local state as well. It can introduce duplications and inconsistency. So to avoid that, we need to have a single area, a single store which can be considered as single source of truth and we can trust that and we can keep everything inside it. Principle number two is that the state and the values that we are going to keep inside Redux, they will be read only. You can't change them directly. You have to go through a dispatch process, which is going to require an action. So, you have to call an action function and based on that function, you are going to write down your state updating logic inside that…

Contents