DEV Community

Discussion on: React lifecycle methods

Collapse
 
aprindev profile image
AprinDev

You said that we can use componentDidMount in class component only ,so How can we use these lifecycles in function componenets???

Collapse
 
cesareferrari profile image
Cesare Ferrari • Edited

Thanks for the question. You can convert the functional component to a class component, or you can use lifecycle methods with a functional component via hooks. I will write more about this in the future.