bonham000 / fcc-react-tests-module

The original freeCodeCamp React/Redux alpha curriculum.
http://hysterical-amusement.surge.sh/
BSD 3-Clause "New" or "Revised" License
77 stars 38 forks source link

Output of Redux challenges #150

Closed dgrcode closed 7 years ago

dgrcode commented 7 years ago

I would say that most of the Redux challenges could benefit from having an output that could show the user what the code is doing.

I've gone through all the 18 Redux challenges and I've found that just a few of them output something. I mean, you can code the challenge, pass all the tests, but you don't see anything in the console that shows you what you code is doing. I also think that showing the users how the state is evolving by using console.log(), can make them play around with the code to see how that output changes if they dispatch something new.

After analyzing the different challenges, I would say that they can be classified into:

For example, for challenges 7 and 8, I would include the following lines at the end of the current code seed:

// output code
console.log('Initial state: authenticated = ' + store.getState().authenticated);
store.dispatch(loginUser());
console.log('After dispatching loginUser(): authenticated = ' + store.getState().authenticated);
store.dispatch(logoutUser());
console.log('After dispatching logoutUser(): authenticated = ' + store.getState().authenticated);

I am happy to help here and write some PR. I prefer to wait until you decide if that's worth it and, in case it is, to agree in a "style" for the logs.

Note: Some test cases wouldn't work after dispatching some actions to the store. This happens because the test expects the final state of the store -after executing all the code- to be a particular one. Dispatching some actions to the store can modify that expected final state.

bonham000 commented 7 years ago

@dhcodes yeah, I agree with you that we could provide better feedback to the user on the Redux challenges. As it stands now, the console.log is basically hacked to provide output to the user here in this app and it definitely won't be like this once the challenges are merged into the FCC codebase.

So I will put this on hold for now and try to just take a look once we get to that point about providing feedback in the Redux section.