Reducers

Developed with
QA

The course is part of this learning path

ReactJS: Zero to Hero
14
7
2
1
Start course
Overview
Difficulty
Beginner
Duration
23m
Students
193
Ratings
3/5
starstarstarstar-borderstar-border
Description

This module looks at how to manage state in React. You’ll be looking at state management, context, and reducers.  

Learning Objectives 

The objectives of this module are to provide you with an understanding of: 

  • State Management  
  • Context  
  • How to create and provide context  
  • Reducers  
  • How to provide dispatch 

Intended Audience  

This learning path is aimed at all who wish to learn how to use the ReactJS framework.  

Prerequisites

It is essential you understand the face of contemporary web development to attend this course. We insist upon JavaScript experience, along with good HTML and CSS skills. 

Feedback 

We welcome all feedback and suggestions - please contact us at qa.elearningadmin@qa.com to let us know what you think. 

Transcript

- [Narrator] Now that we've abstracted state from components into context, we need to look further into how we can obtain initial values and update state. One strategy we can use here is to leverage to power of reducers. Reducers are not a concept that are exclusive to react. In fact they are basically a JavaScript function. The idea of a reducer is that it takes the previous state and an action and returns a brand new state based on these arguments. There are two basic principles for using reducers, but they're a good line to follow wherever you may use state. The first is that state should never be mutated. It should always be reset, even if the state is the same. The second principle is that the previous state can be used as part of the new state by using JavaScript spread operator. If you aren't familiar with the spread operator I suggest you pause the video and go and look it up. To use reducer, you need to be able to dispatch actions from components in the app, recognize that that has happened, and then be able to respond to them appropriately.

Lectures

Introduction to State Management - Context - How to Create and Provide Context - Consume Context - Actions in Reducers - The useReducer Hook - Providing Dispatch

About the Author
Avatar
Ed Wright
Senior Learning Consultant
Students
8833
Labs
7
Courses
29
Learning Paths
7

Ed is an Outstanding Trainer in Software Development, with a passion for technology and its uses and holding more than 10 years’ experience.

Previous roles have included being a Delivery Manager, Trainer, ICT teacher, and Head of Department. Ed continues to develop existing and new courses, primarily in web design using: PHP, JavaScript, HTML, CSS, SQL, and OOP (Java), Programming Foundations (Python), and DevOps (Git, CI/CD, etc). Ed describes himself as practically minded, a quick learner, and a problem solver who pays great attention to detail. 

Ed’s specialist area is training in Emerging Technologies, within Web Development. Ed mainly delivers courses in JavaScript covering vanilla JS, ES2015+, TypeScript, Angular, and React (the latter is authored by Ed) and has delivered on behalf of Google for PWAs. Ed has also developed a new suite of PHP courses and has extensive experience with HTML/CSS and MySQL. 

Ed is responsible for delivering QA’s Programming Foundations course using the Eclipse IDE. His skillset extends into the DevOps sphere, where he is able to deliver courses based around Agile/Scrum practices, version control, and CI/CD.

Covered Topics