Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Building Applications with React and Redux Actions, Dispatch, and Reducers. Oh my! Intro to Reducers

Maria Stommes
Maria Stommes
17,140 Points

Why not set the score in the reducer to score: action.score? Action might be ADD_PLAYER_WITH_INTIALSCORE

Is adding a state for our score something we would do or is just set to 0 as a default and another action like UPDATE_SCORE would be better? I'm assuming the initial score may not be 0. export default function Player(state=initialState, action){ switch(action.type){ case:ADD_PLAYER_WITH_SCORE; return [ ...state, { name: action.name, score: action.score } ]; } }