以下是我的本机应用程序的文件:
UserReducer.js
import { ActionTypes } from '../actions/ActionConstants';
export default function UserReducer(state = {}, action) {
switch (action.type) {
case ActionTypes.LOGIN_REQUEST:
return {
...state
};
case ActionTypes.LOGIN_SUCCESS:
return {
...state
};
case ActionTypes.LOGIN_FAILURE:
return {};
case ActionTypes.LOGOUT:
return {};
default:
return state
}
}
RootReducer.js
import { combineReducers } from 'redux';
import UserReducer from './UserReducer';
const rootReducer = combineReducers({
user: UserReducer,
});
export default rootReducer;
在reducers文件夹中的index.js
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import rootReducer from './RootReducer';
const loggerMiddleware = createLogger();
export const store = createStore(
rootReducer,
applyMiddleware(
thunkMiddleware,
loggerMiddleware
)
);
通过react-native run-android运行我的应用程序。 UserReducer的默认导出给我这个错误:(0,_reducers2.default)不是一个函数
答案 0 :(得分:0)
尝试这种方式(没有功能名称的箭头功能):
/// <summary>
/// A <see cref="System.Windows.Forms.CheckBox"/> with the ability to reverse the checkstate order.
/// </summary>
/// <seealso cref="System.Windows.Forms.CheckBox" />
public class CheckBoxReversible : CheckBox
{
private bool FInvertCheckStateOrder;
/// <summary>
/// Gets or sets a value indicating whether to invert the check state order from [Indeterminate->Unchecked->Checked] to [Indeterminate->Checked->Unchecked].
/// </summary>
/// <value>
/// <c>true</c> to invert the check state order; otherwise, <c>false</c>.
/// </value>
public bool InvertCheckStateOrder
{
get { return FInvertCheckStateOrder; }
set { FInvertCheckStateOrder = value; }
}
/// <summary>
/// Löst das <see cref="E:System.Windows.Forms.Control.Click" />-Ereignis aus.
/// </summary>
/// <param name="e">Eine Instanz der <see cref="T:System.EventArgs" />-Klasse, die die Ereignisdaten enthält.</param>
protected override void OnClick(EventArgs e)
{
if (this.InvertCheckStateOrder)
{
if (this.CheckState == CheckState.Indeterminate)
this.CheckState = CheckState.Checked;
else
if (this.CheckState == CheckState.Checked)
this.CheckState = CheckState.Unchecked;
else
if (this.CheckState == CheckState.Unchecked)
this.CheckState = this.ThreeState ? CheckState.Indeterminate : CheckState.Checked;
}
else
base.OnClick(e);
}
}
请让我知道这是否正确。