首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用简单的反应管-还原?

如何使用简单的反应管-还原?
EN

Stack Overflow用户
提问于 2022-07-12 05:07:21
回答 1查看 152关注 0票数 2
代码语言:javascript
复制
/* eslint-disable import/no-cycle */
import {action, createStore} from 'easy-peasy';
import reactotron from 'reactotron-react-native';
import {applyMiddleware, compose} from 'redux';
import drawerModal from '../models/drawerModal';


let initialState = {};

const store = createStore(
  {
    drawerModal,
    reset: action(() => ({
      ...initialState,
    })),
  },
  {name: 'easystore', compose: applyMiddleware([reactotron.createEnhancer()])}
);

initialState = store.getState();
export default store;

我试着这样做,但没有起作用

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-22 06:44:44

更新2022年8月29日,其工作方式如下

配置文件ReactotronConfig.js

代码语言:javascript
复制
import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux'

const reactron= Reactotron.configure({
  name: 'My App',
  host: '192.168.1.9',
})
  .useReactNative({
    storybook: true,
    asyncStorage: false, // there are more options to the async storage.
    networking: {
      // optionally, you can turn it off with false.
      ignoreUrls: /symbolicate/,
    },
    editor: false, // there are more options to editor
    overlay: false, // just turning off overlay
  })
  .use(reactotronRedux()) 
  .connect();

  export default reactron

在store.js中使用该文件

代码语言:javascript
复制
import {action, createStore} from 'easy-peasy';

import exploredMovies from './models/exploredMovies';
import reactron from '../helpers/ReactotronConfig';

let initialState = {};
window.requestIdleCallback = null;
const store = createStore(
  {

    exploredMovies,
    reset: action(() => ({
      ...initialState,
    })),
  },
  {name: 'easystore', enhancers: [reactron.createEnhancer()]}
);

initialState = store.getState();
export default store;

===========================================

2022年7月12日

我和社区讨论过,但不支持。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72947271

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档