Użyj odrzutu 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;
// Other File
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
}
Better Bug