use recoil oitside code example
Example: use recoil oitside
import React from 'react';
import RecoilOutside from "recoil-outside";
import { RecoilRoot } from "recoil";
import Main from "./Main"
const App = () => {
return (
<RecoilRoot>
<RecoilOutside/>
<Main />
</RecoilRoot>
);
};
export default App;
import { promiseSetRecoil, promiseGetRecoil } from "recoil-outside"import { store } from "./Store"
export const setTest = async() => {
await promiseSetRecoil(store, "Success")
}
export const getTest = async() => {
const value = await promiseGetRecoil(store)
return value
}