We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export function handleInitData(){ return (dispatch)=>{ return API.getInitialData().then(({tweets,users})=>{ **dispatch(receiveTweets(tweets))** dispatch(receiveUsers(users)) dispatch(authedUser(AUTHED_USERS)) }) } }
1、如果一开始获取tweet、后面获取用户会报错,如下所示(users[tweet.author] 这个或报错的原因是要使用users 没有用户。
function mapStateToProps({tweets,users,authedUser},{tweetId}) { let tweet = tweets[tweetId] const parentTweet = tweet.replyingTo === null ? null:tweet.replyingTo console.log(users[tweet.author]) return { authedUser, // tweetList:formatTweet(tweet,users[tweet.author],authedUser,parentTweet) }
解决方案:
export function handleInitData(){ return (dispatch)=>{ return API.getInitialData().then(({tweets,users})=>{ **dispatch(receiveUsers(users))** dispatch(receiveTweets(tweets)) dispatch(authedUser(AUTHED_USERS)) }) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1、如果一开始获取tweet、后面获取用户会报错,如下所示(users[tweet.author] 这个或报错的原因是要使用users 没有用户。
解决方案:
The text was updated successfully, but these errors were encountered: