What is the difference between react: class vs function App()?

When I download a react project, my default in App.js is :

function App()

However, a lot of YouTube tutorials uses:

class App extends React.Component {

Is there a difference between the two? Is one just older?

Answer

Functional components have somewhat replaced class components because they generate less output code. Previously, classes were used to be able to use the state. However, this is now possible with the useState hook.