Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fortunately, componentWillMount is largely made redundant by the use of constructors.


Except it's not for when you actually want to know when the component was put into the DOM, or you're running react server-side


> when you actually want to know when the component was put into the DOM

You can use componentDidMount for that and its semantics are still the same.


Yes, componentDidMount is the place to work with DOM. componentWillMount never worked this way—it is basically a glorified constructor from pre-ES6 era.


Oh apologies - I really the comment as componentDidMount. My bad.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: