Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update reactotron recipe #776

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions website/docs/docs/recipes/connecting-to-reactotron.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
# Connecting to Reactotron

[Reactotron](https://github.com/infinitered/reactotron) is a desktop app for inspecting your React JS and React Native projects.
[Reactotron](https://github.com/infinitered/reactotron) is a desktop app for
inspecting your React JS and React Native projects.

It is possible to configure Easy Peasy so to be connected to your Reactotron instance.
It is possible to configure Easy Peasy so to be connected to your Reactotron
instance.

Firstly, ensure you have a Reactotron configuration similar to.

```javascript
// reactotron-config.js

import Reactotron from "reactotron-react-native";
import { reactotronRedux } from "reactotron-redux";

const reactotronConfig = {
initiate: () => {
Reactotron.configure()
.useReactNative()
.use(reactotronRedux())
.connect();
},
createEnhancer: () => Reactotron.createEnhancer()
};

export default reactotronConfig;
// reactotron.js

import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';

const reactron = Reactotron.configure()
.useReactNative()
.use(reactotronRedux())
.connect();

export default reactron;
```

Then update the manner in which you create your Easy Peasy store.

```javascript
// create-store.js

import { createStore } from "easy-peasy";
import model from "./model";
import { createStore } from 'easy-peasy';
import model from './model';

// There might be an issue causing `setItem` not being called correctly
// for iOS devices using React Native. The solution for this is currently
// to remove the implemenation of `requestIdleCallback`.
// Read this issue for more information: https://github.com/ctrlplusb/easy-peasy/issues/599
window.requestIdleCallback = null;

let storeEnhancers = [];

if (__DEV__) {
const reactotron = require("../reactotron-config").default;
reactotron.initiate();
const reactotron = require('./reactotron').default;
storeEnhancers = [...storeEnhancers, reactotron.createEnhancer()];
}

Expand All @@ -46,4 +48,4 @@ const store = createStore(model, {
});

export default store;
```
```