I am new to recoil, and I am using all class components. Here is my recoil state
export const tokenState = atom({
key: "tokenState",
default: "",
});
How to use recoil in class component and set the token?
I have used RecoilRoot in app as
<RecoilRoot>
<Header />
<Main />
</RecoilRoot>
In login.js, I want to set the token in recoil, but login.js is a class component.
const res = await APIS.login(apiRoute,requestObject);
In res.data.token I am getting the jwt token.
Thank you in advance!