【发布时间】:2020-07-21 12:59:44
【问题描述】:
在没有任何其他额外库的情况下调度CREATE_ACCOUNT 操作后,从redux-store 清除account、image、name 状态的最简单方法是什么,
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
【问题讨论】:
-
你可以看看这个帖子:stackoverflow.com/questions/41392964/…
标签: javascript arrays react-native redux react-redux