먼저 설명에 나온대로 패키지부터 설치해 줍시다.
yarn add https://github.com/aylonmuramatsu/reactotron-zustand-plugin.git
or
npm i https://github.com/aylonmuramatsu/reactotron-zustand-plugin.git --save
작업을 해주기 전에 우선 zustand store의 설정을 한대 모아 작업을 미리 해주면 편할 것 같아 다음과 같은 코드를 zustand store를 한데 모은 파일안에 생성해 주었습니다. (더 효율적인 방법이 있다면 추천 부탁드립니다. 제 실력이...)
import { useToastStore } from './toast';
import { useUserStore } from './user';
const zustandStore = [
{ name: 'toast', zustand: useToastStore },
{ name: 'user', zustand: useUserStore },
];
export { zustandStore };
그 후 RactrotronConfig.js 파일
import reactotronPluginZustand from 'reactotron-plugin-zustand';
import { zustandStore } from './src/store/store';
Reactotron.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
.configure({
name: 'Name Project',
}) // controls connection & communication settings
.useReactNative() // add all built-in react native plugins
.use(
//add this line 🙌
reactotronZustand({
stores: zustandStore,
})
) // plus some custom made plugin.
.connect(); // let's connect!
import reactotronPluginZustand from 'reactotron-plugin-zustand';
import { zustandStore } from './src/store/store';
Reactotron.setAsyncStorageHandler(AsyncStorage)
.configure({
name: 'FineMe',
})
.useReactNative({
asyncStorage: { ignore: ['secret'] },
networking: {
ignoreUrls: /https:\/\/clients3.google.com\/generate_204/,
},
})
.use(
asyncStorage(),
asyncStorage(),
networking(),
reactotronPluginZustand({ stores: zustandStore }),
);
import reactotronPluginZustand from 'reactotron-plugin-zustand';
import { zustandStore } from './src/store/store';
Reactotron.setAsyncStorageHandler(AsyncStorage)
.configure({
name: 'FineMe',
})
.useReactNative({
asyncStorage: { ignore: ['secret'] },
networking: {
ignoreUrls: /https:\/\/clients3.google.com\/generate_204/,
},
})
.use(asyncStorage())
.use(networking())
.use(reactotronPluginZustand({ stores: zustandStore }));
유익한 글이었습니다.