In this example, we will see how to get started with react. We will be creating a simple Hello React App using React. Before we get started, make sure you have the node installed on your system.
npx create-react-app app-name
This syntax will set up everything we need for the react app.
cd app-name
npm start
The cd app-name
will take us to the project directory and npm start
runs that react app.
The project will start on localhost:3000
and will look like this:
let's edit App.js
to print a simple "Hello React" text.
import './App.css';
function App() {
return (
<div className="App">
<h1>Hello React </h1>
</div>
);
}
export default App;
Output
In this example, we learned how to get started with react. We created a simple Hello React App using React.