React and Redux: Moving Forward From Here

React and Redux: Moving Forward From Here
0

#1

Tell us what’s happening:

Your code so far


// import React from 'react'
// import ReactDOM from 'react-dom'
// import { Provider, connect } from 'react-redux'
// import { createStore, combineReducers, applyMiddleware } from 'redux'
// import thunk from 'redux-thunk'

// import rootReducer from './redux/reducers'
// import App from './components/App'

// const store = createStore(
//   rootReducer,
//   applyMiddleware(thunk)
// );

// ReactDOM.render(
//   <Provider store={store}>
//     <App/>
//   </Provider>,
//   document.getElementById('root')
// );

// change code below this line
const logger = createLogger({
  stateTransformer: (state) => {
    let newState = {log: 'Now I know React and Redux!'};

    for (var i of Object.keys(state)) {
      if (Immutable.Iterable.isIterable(state[i])) {
        newState[i] = state[i].toJS();
      } else {
        newState[i] = state[i];
      }
    };

    return newState;
  }
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/moving-forward-from-here/


#2

I really have no idea what this challenge is looking for? OK over thinking as usual I guess this part of the instructions say it all: “Log the message ‘Now I know React and Redux!’ to the console.” Out of complete desperation i tried:

console.log('Now I know React and Redux!');

And It passed??? I still don’t get the point of this! I guess doing it in codepen?


#3

Yes, that is how you do it. They just wanted you to see the commented code of how a React/Redux file might normally look and needed to give you something to do to pass. That line is exactly what they wanted you to do. I know, a little silly.


#4

I started writing like 20 lines of code importing a logger and info level log of ‘Now I know React and Redux!’ it was brutal…

const logger = createLogger({
    level: 'info',
    collapsed: true,
    predicate: (getState, action) => {action.type; }
});

Out of sheer desperation I cut and pasted from the instructions Log console.log the message ‘Now I know React and Redux!’ to the console. Then I all most fell out of my chair when it passed…


#5

Yeah I hear ya’. One hint would have been that they hadn’t covered any of that stuff. The line says:

Log the message ‘Now I know React and Redux!’ to the console.

That has all the information you should need to realize that you need console.log. But I’ve been there too - thought I needed to something really complex and it turned out to be really simple and I should have figured it out in the first place if I’d paid closer attention. A good lesson hear is “read instructions very closely and analyze what it is telling you”. That will serve you well in interview coding challenges as well - people have a habit of making assumptions when they’re reading the instruction. Coders that pay close attention to details and ask questions about anything that is unclear/vague get extra points. In my last few interviews, they were impressed that I caught minute details that other people missed.