应用程序屏幕变为空白并显示错误(类型错误:赋值给常量)



有人知道为什么我的移动应用程序显示空白屏幕,但在网络上工作吗?

const [access_token, setAccessToken] = useState();
const [refresh_token, setRefreshToken] = useState();

if (access_token) {
localStorage.setItem('refresh_token', JSON.stringify(refresh_token));
localStorage.setItem('access_token', JSON.stringify(access_token));
// localStorage.setItem('expires_in', JSON.stringify(expires_in));
} else {
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
}

You should use setAccessToken and setRefreshToken for assignmentn not 
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
setAccessToken(localStorage.getItem('access_token'))
setRefreshToken(localStorage.getItem('refresh_token'))

相关内容

  • 没有找到相关文章

最新更新