react-native - 如何将reactotron-redux与easy-peasy一起使用?

标签 react-native redux easy-peasy reactotron

/* 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;

我尝试了这个方法,但没有成功

最佳答案

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

配置文件ReactotronConfig.js

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 中使用该文件

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 日

enter image description here

我与社区讨论过,但不支持

关于react-native - 如何将reactotron-redux与easy-peasy一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72947271/

相关文章:

react-native - Detox Flatlist 不滚动

android - React Native Geolocation Watchposition 不会实时更新

javascript - React Native 模态选择器中的全屏

javascript - 通过 Redux 使用 Web-Worker 的 Promise

react-redux - Easy Peasy VS React Redux

javascript - 从单个组件访问多个简单的商店

ios - 词法或处理器问题 : boost/config/user. hpp' 文件未找到

javascript - es7 object spread notational 如何创建一个浅拷贝来替换原始对象?

javascript - Redux 状态不更新数组