React is a JavaScript library for building user interfaces. We can start React by building a simple app.To get started, first of all, make sure to have the node installed in 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 modify 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;
Here, we created a simple react app just to get started with react. You can learn more on react on our site ahead.