Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

react中dispatch action修改redux store之后,useselector无法获取最新的store

react中dispatch action修改redux store中的province之后,useselector无法获取最新的province,但是可以在redux devtool中看到更新之后的province
image.png
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

在全国地图点击某省,根据province请求数据,之后在省内点击市,根据redux中的province和city请求数据,dispatch之后拿到是初始值空字符串,却拿不到修改后provinceimage.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...