Tell us what’s happening:
Ok so ive spent the last few days going though the redux part of front end libs and felt pretty good that i was getting a basic understanding but now have hit abit of a confusing step entering redux+react
in the redux phase stores were created muitiple times like this:
const reducer = (state, action) => {
// with a switch statement here or if checking action.type and returning some data based off that
}
const store = Redux.createStore(reducer)
now this next bit was called a 'review ’ so i should know it right, however the correct answer to the question just below and is very differnt than how we learnt it. now the other method doesnt pass for these challenges.
so what i want to know is this something directly differnt because we are now using redux with react?
with some other view libarys redux works with createStore but not with react and hence we have to declare everything differently or have i misunderstood something and shud go bak to the redux part?
Your code so far
let messageReducer = (state, action) => {
return [...state, action.message] //missing any type checks
}
let store = {
state: [],
getState: () => store.state,
dispatch: (action) => {
if (action.type === ADD) {
store.state = messageReducer(store.state, action); // this is all in the store creation since because of react?
}
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
.
Link to the challenge: