React functional component vs class component

Ask a question+

Can someone explain which one is more useful to use, and why??

add comment

1 Answer


Before the introduction of React Hooks, you had to use Class Components to be able to use lifecycle methods (componentDidMount..) and locale state.

You don’t need anymore with React hooks, and today, you should only use functional component. They are much easier to read, test and debug and you’ll end up with less code to write.

add comment

Your Answer