What is the easiest way to clear the account
,image
, name
state from the redux-store after CREATE_ACCOUNT
action dispatched without any other additional library,
import { CREATE_ACCOUNT } from '../actions/meals'
const initialState = {
account: [],
image:[],
name:''
}
const addPerson = (state=initialState, action) =>{
switch(action.type){
case CREATE_ACCOUNT:
const newAccount = new newAccount(
Date.now().toString(),
action.accountData.name,
action.accountData.image,
action.accountData.email,
action.accountData.password
)
return {account: state.account.concat(newAccount) }
default:
return state
}
}
export default addPerson