Functional vs Class-Components in React

In this article I want to show you the differences between functional and class components in React and when you should choose which one.

But first let me give you a brief introduction to React components from the documentation:

The simplest way to define a component in React is to write a JavaScript function:

function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}

It’s just a function which accepts props and returns a React element.
But you can also use the ES6 class syntax…