I am trying to run below code on challenge
section but it is giving me error
Blockquote
require is not defined
Blockquote
while i did not use require any where.
Code:
import React from 'react';
import { createStore } from 'redux'
// define ADD, addMessage(), messageReducer(), and store here:
const ADD = 'ADD';
function addMessage(message) {
return {
type: ADD,
message
};
};
const initital_state = {
message:[]
};
function messageReducer(state=initital_state, action) {
switch(action.type){
case ADD: return Object.assign({}, state, {
message: action.message
});
default: return state;
}
}
const store = createStore(messageReducer);
store.dispatch(addMessage('hello'));