ncesar
ncesar

Reputation: 1792

Create-react-app creating App.js without Component after update

Today i updated my node, npm and create-react-app version and now everytime i create a new app, the App.js doesn't come with Component, its just creates a function as you can see below.

function App() {
  return (
    <div className="App">
    </div>
  );
}

before it was

class App extends Component {
  render() {
    return <div />;
  }
}

Did things changed in the 3.0.0 create-react-app version?

Nodejs version: v10.15.3

Npm version: 6.4.1

Upvotes: 2

Views: 1816

Answers (1)

Sachin
Sachin

Reputation: 179

That App function is a valid React component. It is a functional component as opposed to a class component in your second example.

You are correct, this change was made in v3.0.0: change class component to function component

Upvotes: 6

Related Questions