Skip to content

Commit

Permalink
orb(reactotron): docs(redux): update enhancers with proper example co…
Browse files Browse the repository at this point in the history
…de (#1511 by @frankcalise)

## Please verify the following:

- [ ] yarn run v1.22.22
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. passes
- [ ] I have added tests for any new features, if relevant
- [ ]  (or relevant documentation) has been updated with your
changes

## Describe your PR
- Closes #1450 with updated documentation
- Updates docs with the redux code we provide in the  (8ec0e103606372684c2652259a8891fb373bc6f3)
  • Loading branch information
infinitered-circleci committed Feb 7, 2025
1 parent b047f44 commit 3b3b8fa
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
5 changes: 3 additions & 2 deletions docs/react-native-mlkit/contributing/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"position": 1000,
"link": {
"type": "generated-index",
"description": "How to run the included example application."
"description": "How to run the included example application.",
"slug": "/react-native-mlkit/contributing/list"
}
}
}
5 changes: 3 additions & 2 deletions docs/react-native-mlkit/document-scanner/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"position": 500,
"link": {
"type": "generated-index",
"description": "Scan documents with your camera"
"description": "Scan documents with your camera",
"slug": "/react-native-mlkit/document-scanner/list"
}
}
}
5 changes: 3 additions & 2 deletions docs/react-native-mlkit/face-detection/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"position": 100,
"link": {
"type": "generated-index",
"description": "Label images with TFLite Models"
"description": "Label images with TFLite Models",
"slug": "/react-native-mlkit/face-detection/list"
}
}
}
5 changes: 3 additions & 2 deletions docs/react-native-mlkit/image-labeling/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"position": 200,
"link": {
"type": "generated-index",
"description": "Label images with TFLite Models"
"description": "Label images with TFLite Models",
"slug": "/react-native-mlkit/image-labeling/list"
}
}
}
7 changes: 4 additions & 3 deletions docs/react-native-mlkit/object-detection/_category_.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"label": "Object Detection",
"position":400,
"position": 400,
"link": {
"type": "generated-index",
"description": "Detect Object"
"description": "Detect Object",
"slug": "/react-native-mlkit/object-detection/list"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"position": 99,
"link": {
"type": "generated-index",
"description": "How to run the included example application."
"description": "How to run the included example application.",
"slug": "/react-native-mlkit/running-the-example-app/list"
}
}
}
17 changes: 13 additions & 4 deletions docs/reactotron/plugins/redux.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,25 @@ ReactotronConfig, you'll need to add `reactotron-redux` as plugin
+ export default reactotron // also: export me so I can be referenced by Redux store
```

Then, add enhancer from `Reactotron.createEnhancer()`
Next, we'll add the enhancer from `Reactotron.createEnhancer()` in development.

## Using Redux-Toolkit configureStore

Using [Redux-Toolkit's `configureStore`](https://redux-toolkit.js.org/api/configureStore), add as an `enhancer`.
Using [Redux-Toolkit's `configureStore`](https://redux-toolkit.js.org/api/configureStore), add the `enhancers` key.

```tsx
const createEnhancers = (getDefaultEnhancers: GetDefaultEnhancers<any>) => {
if (__DEV__) {
const reactotron = require("../devtools/ReactotronConfig").default
return getDefaultEnhancers().concat(reactotron.createEnhancer())
} else {
return getDefaultEnhancers()
}
}

```
export const store = configureStore({
reducer: persistedReducer,
enhancers: __DEV__ ? [reactotron.createEnhancer!()] : [],
enhancers: createEnhancers,
})
```

Expand Down

0 comments on commit 3b3b8fa

Please sign in to comment.