This challenge is saying that "data" is not defined, please house can someone come to my rescue. I'm stucked

Tell us what’s happening:

Your code so far


const ADD_NOTE = 'ADD_NOTE';

const notesReducer = (state = 'Initial State', action) => {
switch(action.type) {
  // Change code below this line
case ADD_NOTE:
return (data.text);
  // Change code above this line
  default:
    return state;
}
};

const addNoteText = (note) => {
// Change code below this line
return {
type:ADD_NOTE, text:note 
};
// Change code above this line
};

const store = Redux.createStore(notesReducer);

console.log(store.getState());
store.dispatch(addNoteText('Hello!'));
console.log(store.getState());

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10.0; S21 Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.116 Mobile Safari/537.36 EdgA/45.07.2.5059.

Challenge: Send Action Data to the Store

Link to the challenge:

Hello @Claeiyke,

Gave you tried to debug your code simply logging variables into console? If no, this is a good starting point when you get stuck.

I suggest you to comment in line where you are returning data.text and add something like console.log(state, action) before it.

console.log(state, action)
// return (data.text);

I hope this will help you to understand what is your mistake and where you did it.

Feel free to ask if you need more assistance.

It’s right. data is not defined; you didn;t declare it.
You are asked to return the text prop on the action (object).

return (action.text)

Thanks for your contribution.

Thanks for your help.