Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

next.js的url上携带参数时,为什么会默认执行一次componentDidUpdate周期函数?

我在本地使用next.js时发现,当我浏览器上的url带有参数时,我的组件都会默认执行一次componentDidUpdate生命周期函数,而当去掉url上的参数时又不会默认执行一次componentDidUpdate生命周期函数了。
如:
url为http://localhost:3000时,进入页面只执行了componentDidMount生命周期函数;
url为http://localhost:3000/?test=132时,进入页面执行了componentDidMount生命周期函数后又执行了componentDidUpdate生命周期函数。

不是很明白next.js是怎么处理的,或者说这样处理是有什么意义?劳烦各位大神解解惑


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

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...