use-reducer-flipper
v1.0.3
Published
Use Reducer Hook API for flipper
Downloads
6
Readme
UseReducer Flipper
UseReducer Logger for Flipper. It can log useReducer actions and show inside Flipper using flipper-plugin-redux-debugger .
Support
- React Native
- For
react-native
>= 0.62, flipper support is enabled by default - For
react-native
< 0.62, follow these steps to setup your app
- For
- UseReducer
Get Started
- Install useReducer-flipper and
react-native-flipper
in your React Native app:
yarn add use-reducer-flipper react-native-flipper
# for iOS
cd ios && pod install
- Add the logger into your useReducer store:
import flipperLogger from 'use-reducer-flipper';
export const StateProvider = ({ children }) => {
const [value, dispatch] = useReducer(__DEV__ ? flipperLogger(reducers) : reducers, initialState);
return <StateContext.Provider value={[value, dispatch]}>{children}</StateContext.Provider>;
};
- Install flipper-plugin-redux-debugger in Flipper desktop client:
Manage Plugins > Install Plugins > search "redux-debugger" > Install
- Start your app, then you should be able to see Redux Debugger on your Flipper app