首页 > react native怎么做登录权限?

react native怎么做登录权限?

初学react-native使用redux怎么做登录模块?有什么例子或方案?
类似简书这样的登录方案是如何实现的?没登陆的时候只能看,登录时候tab都变了,感觉整个app都刷新了


你可以用redux-effects把cookie/localstorage给引进来, 其它就和你正常使用redux区别不大了
登录与否你可以在app层判断cookie/localstorage引入不同的component(当然别忘了和服务器发个请求校验下)

redux-effects:
https://github.com/redux-effects/redux-effects

这里有个example:
https://github.com/erikras/react-redux-universal-hot-example

(我还没有实践过在需要登录态的项目中使用react, 只是想了下认为这样应该可行)


以前在udemy的redux课程上讲过一个用redux + react 实现authentication的例子,后端就是用node js
这是例子代码的github链接,希望有帮助
https://github.com/StephenGrider/AdvancedReduxCode/tree/master/auth

【热门文章】
【热门文章】