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
2.9k views
in Technique[技术] by (71.8m points)

请问我在这里点击li的a与b时,{console.log('a')}为什么不运行。

https://codepen.io/wildor/pen...
setState刷新的问题,谢谢。只有第一次初始化时,{console.log('a')}会运行


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

1 Answer

0 votes
by (71.8m points)

setState只导致了Welcome组件内部更新,和{console.log('b')}所在的外层没有关系,当然不会运行了。


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

...