react-native-flipper-zustand
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

React Native Zustand Flipper

This plugin allow see actions of zustand on react native.

⚠️ Please use zustand v4

Installation

First install zustandstore on Flipper Plugin Manager.

Next, install react-native-flipper-zustand package on your React Native project.

yarn add react-native-flipper-zustand -D

Or npm

npm i react-native-flipper-zustand --save-dev

Usage

import create from  'zustand';
import zustandFlipper from 'react-native-flipper-zustand';

const useStore = create(
	zustandFlipper(set => ({
	  bears: 0,
	  // "set" now receives as the third parameter, the name of an action that will be shown in Flipper
	  increasePopulation: () => set(state => ({ bears: state.bears + 1 }), false, 'increasePopulation'),
	  removeAllBears: () => set({ bears: 0 }, false, 'removeAllBears')
	}))
);

TypeScript

import create from  'zustand';
import zustandFlipper from 'react-native-flipper-zustand';

type BearStoreT = {
	bears: number;
	increasePopulation: () => void;
	removeAllBears:  () => void;
}

const useStore = create<BearStoreT>()(
	zustandFlipper(set => ({
	  bears: 0,
	  // "set" now receives as the third parameter, the name of an action that will be shown in Flipper
	  increasePopulation: () => set(state => ({ bears: state.bears + 1 }), false, 'increasePopulation'),
	  removeAllBears: () => set({ bears: 0 }, false, 'removeAllBears')
	}))
);

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-flipper-zustand

Weekly Downloads

1,255

Version

3.0.1

License

MIT

Unpacked Size

3.93 kB

Total Files

4

Last publish

Collaborators

  • mariano1491