The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Redux: Writing a Todo List Reducer (Adding a Todo)

Redux: Writing a Todo List Reducer (Adding a Todo)

4:11
Learn how to implement adding a todo in a todo list application reducer.
Watch this lesson now
Avatar
egghead.io

Learn how to implement adding a todo in a todo list application reducer.

Avatar
Sequoia McDowell

Do you recommend using something like Immutable.js here? Writing all these non-mutating functions using spread operator etc. seems prone to error. Do you have opinions for/against immutable.js or equivalent & would you recommend it for use with redux?

In reply to egghead.io
Avatar
Dan Abramov

If you are comfortable with its API and bundled size, sure. This is really entirely up to you.

In reply to Sequoia McDowell
Avatar
jpbamberg1993

Why are you setting the default state of the reducer to an empty array? Why not an empty hash {}? since it is being placed within an array? and the array is supposed to be an array of objects?

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?