What is ReactJS?
How to Create react app
Open your terminal in the directory you would like to create your application. Run this command to create a React application named my-react-app:
npx create-react-app my-react-app
OR, you can directly make your application without specifying a name, like this:
npx create-react-app .
Note: When creating a folder name, make sure there are no spaces or capital letters in it because of npm naming restrictions.
Once the base application is created, if the folder is specified you just have to enter the folder name. You can use this command to enter:
Then just start up the application with the given command:
and you are good to go!
const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<h1>Hello, world!</h1>);
In this, we are just putting
<h1> a tag in a div with id ‘root’. That’s it! In div with id ‘root’ everything will be rendered.
More of React.js