here"s the thing!
the project uses react + axios
, and token needs to be set in header for axios to send requests.
is that token is returned from the login api interface. So obviously, this token is worth saving as a global variable. This token is needed because the axios sending interface is also used in other components.
- is stored in localstorage and read from localstorage every time a request is sent.
- Storage with redux
want to ask three questions:
- will there be performance problems in mode 1? after all, localstorage is different from ordinary functions
- Mode 2, if the project itself does not use redux, it seems to be a bit overqualified, which is strange.
- is there another way? how do you deal with it?