Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Redux: Handle an Action in the Store: hidden requirement #142

Open
lynxlynxlynx opened this issue Jul 14, 2018 · 1 comment
Open

Redux: Handle an Action in the Store: hidden requirement #142

lynxlynxlynx opened this issue Jul 14, 2018 · 1 comment

Comments

@lynxlynxlynx
Copy link
Member

Describe the bug
The challenge throws browser console errors if you manually define an explicit new state. It works if you just pass return {login: true};. It can be confusing to the user, since there was no mention of such restrictions, nor is the real error visible without opening the browser console ... which then looks like a pipeline issue. And for complexer states, typing out the whole structure just to change one property is an antipattern.

To Reproduce
https://learn.freecodecamp.org/front-end-libraries/redux/handle-an-action-in-the-store

let newState = { ...state };
newState.login = true;
return newState;

Expected behavior
I think it's enough to add another line to the challenge text telling the users to just return a new anonymous state object.

Desktop (please complete the following information):

  • OS: linux
  • Browser: firefox, chromium
@ojeytonwilliams
Copy link
Contributor

So, the problem is that the editor's Babel preset is es2015 and the syntax to spread objects is a language feature from es2018. I'll take a look and see if that can be updated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants