This plugin integrates Legend-State observables with Reactotron, enabling real-time monitoring and debugging of state changes in applications that use Legend-State for state management.
npm install reactotron-legendstate-pluginIt has been tested with async storage as the storage handler.
Using Yarn:
``bash`
yarn add reactotron-legendstate-plugin
Using npm:
`bash`
npm install reactotron-legendstate-plugin
`javascript
import Reactotron from "reactotron-react-native";
import AsyncStorage from "@react-native-async-storage/async-storage";
import reactotronLegendState from "reactotron-legendstate-plugin";
import observable$ from "path/to/observable";
import { observe } from "@legendapp/state";
Reactotron.setAsyncStorageHandler(AsyncStorage)
.configure({
name: 'Project Name',
})
.useReactNative()
.use(
reactotronLegendState({
stores: [
// Add all observables here
{ name: 'observable', observable: observable$ },
],
observe // Add observe function from legend-state
})
)
.connect();
`
Note: You need to add a new subscription with the store name (in this case, observable`) under the state tab in Reactotron to monitor state changes.