Hello World in React by Modifying the create-react-app Default Page

Hello World in React by Modifying the create-react-app Default Page

Every programming journey begins with a simple hello world code and so as it is for React 🙂 Today we are just going to write a Hello World in React JS to get things started with React. It is easy and pretty straight forward but only thing is that we will be writing the Hello World in the sample project that is created using the create-react-app. So if you do not have the React project created using create-react-app, then follow our article Create New Project using create-react-app.

Once you have created a new React project using create-react-app, open the App.js file located in the src folder of your react project directory and change the code inside the App() function.

By default the App() function code will be like the following:

create-react-app App js file default code

Change this code inside the App() function to the following:

function App() {
  return (
     <h1>Hello World!</h1>
  );
}

Output will be like the following:

Hello World in React modifying create-react-app

Related Posts