我正在尝试学习redux,我不确定当多个用户使用该应用程序时,构建我的应用程序状态的最佳方法是什么 .

应用流程:

每次登录 {userid,username,token} 都存储在 localStorage.appUsers

现在,如果我的应用程序initialState看起来如下

{
 appusers:[],//Array of app users, i only keep the token and id and username and i fetch the full user info from server when user is selected as current logged in.
 currentUser:{id,fullname,picture,...etc} //current user
 blog:[],//array of blog posts of current logged in user
 chat:[],//array of chat messages of current logged in user
}

我也使用localstorage来保存用户状态,以便下次打开app时,它会从localstorage中显示initialState,直到它从服务器刷新缓存 .

问题是,目前博客和聊天为当前登录用户保留了一系列帖子,当用户切换用户时,他会看到其他人的数据 .

那么为每个用户维护单独的商店的正确方法是什么?我试图修改我的初始状态,以便博客和聊天数组成为appUsers的属性,然后我遇到问题的反应 combineReducers ,它期望初始状态中的每个reducer的键 .