Skip to content

componentWillUpdate > nextProps.children is always null? #3602

Answered by rejhgadellaa
rejhgadellaa asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, after more debugging and looking at the data nextProps.children contains during componentWillUpdate(), I think I can answer my own question.

When componentWillUpdate() is called, Preact doesn't (yet) know / isn't concerned if the element will change, so it's null. I assume it's set somewhere during render().

So you can't use componentWillUpdate() to compare current child elements vs next child elements.

Makes sense, I guess :)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rejhgadellaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant