Function react native删除存储上不必要的方法
我在我的react本机应用程序上设置了我的商店,与redux开发工具配合良好, 但是我不知道如何重构Function react native删除存储上不必要的方法,function,react-native,Function,React Native,我在我的react本机应用程序上设置了我的商店,与redux开发工具配合良好, 但是我不知道如何重构 const store = createStore(reducer, /* preloadedState, */ composeEnhancers( applyMiddleware(...middleware))); const configureStore = () => { return store; }; export { configureStore }; 目标是只将“存
const store = createStore(reducer, /* preloadedState, */
composeEnhancers(
applyMiddleware(...middleware)));
const configureStore = () => {
return store;
};
export { configureStore };
目标是只将“存储”导出为函数为什么要将
存储
导出为函数,就像导出为对象一样
export const store = configureStore();
通过这种方式,您也可以将其导入到您喜欢的任何文件中:
从“…”导入{store};
//现在,您可以访问redux存储并分派操作:
store.getState()。。。
存储调度(…)