1. 5
    Create a Redux-Style Reducer Function
    5m 23s

Create a Redux-Style Reducer Function

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

The reducer is at the center of how Redux manages state. In this lesson we’ll create a reducer function and see how Redux takes in state and actions and returns updated state. We’ll write and run unit tests using Jest to verify that our reducer function is working as expected.

Arif
~ 7 years ago

I think this episode should be moved to before Episode 4 (creating a redux store), since the todo reducer code is used there.

Babak Badaei
~ 7 years ago

Right, this episode needs episode should be after 3 and before 4.

Richard Poole
~ 7 years ago

This video would really benefit from at least a basic initial explanation of what a reducer/action/etc does. I've used react/redux a bit already but if I was a newcomer I think I'd be totally lost in the first half of this video.

IAMZEUS
~ 7 years ago

There is a parenthesis missing from the video, test code should be:

describe('Todo Reducer', () => { test('returns a state object', () => { const result = reducer(undefined, {type:'ANYTHING'}) expect(result).toBeDefined() })

Andy Van Slaarsinstructor
~ 7 years ago

There is a parenthesis missing from the video, test code should be:

describe('Todo Reducer', () => { test('returns a state object', () => { const result = reducer(undefined, {type:'ANYTHING'}) expect(result).toBeDefined() })

It looks like it's just past the edge of what's visible in the editor. A missing paren would have caused the test to fail with a syntax error.