【发布时间】:2020-01-12 05:05:22
【问题描述】:
我有两个动作,一个会关闭我的菜单(会是假的),一个会在我的减速器中打开菜单(会是真的)我将初始值设置为 true
import { OPENED_MENU,CLOSED_MENU } from './types';
export const OpenMenu = status => ({
type:OPENED_MENU,
status
});
export const CloseMenu = status => ({
type:CLOSED_MENU,
status
});
减速器:
import { OPENED_MENU, CLOSED_MENU } from '../../actions/menu/types';
const initialState = {
status: true,
};
const CheckingStatus = ( state = initialState, action) => {
switch (action.type){
case OPENED_MENU:
return{
}
case CLOSED_MENU:
return{
}
default:
return state;
}
}
export default CheckingStatus;
我想知道如何在我的操作中返回一个 false 或 true 布尔值。
或者它如何改进我的逻辑。
【问题讨论】: