In this tip we'll see two different methods to create a component when using react: Class Components and Functional Components. Look at the snippets to see how to declare each one of them.
So far we've only seen advantages on using class components so why should we use functional components at all? In terms of performance, the React experts say that functional components are way better and we should use them everytime we can. They also are easier to read and require less code so for simpler components they should be the way to go!
Lastly, even though I said we can't use state or lifecycle methods on functional components, the truth is that since ReactJs 16.8 came out we now have something called Hooks. These allow us to use those features inside our functional components in a different way so keep that in mind!
Hope you've liked this basic explanation of the difference between these two methods to create react components