Closed xdlgj closed 4 years ago
//用来管理当前登录用户的reducer函数 const initUser = AsyncStorage.getItem(USER_KEY) function user (state = initUser, action) { switch (action.type) { case REVICE_USER: return action.user case RESET_USER: return {} default: return state } }
如果是redux,建议配合redux-persist使用,不用自己操心怎么存取
直接用的话,要么await,要么then,没有别的用法
await
then
如果没有存数据,let res = await storage.load({ key: 'theme' }) 会报错
@orzhtml 有其他问题可以另外开个issue具体说一下吗?
//用来管理当前登录用户的reducer函数 const initUser = AsyncStorage.getItem(USER_KEY) function user (state = initUser, action) { switch (action.type) { case REVICE_USER: return action.user case RESET_USER: return {} default: return state } }