React Home

What is ReactJS?

ReactJS (also known as React) is a popular open-source JavaScript library used for building user interfaces (UIs) for web applications. Developed by Facebook, React allows developers to create reusable UI components and efficiently manage the application’s state and logic. React uses a declarative approach to building UIs, meaning that developers describe the desired outcome of a component and React takes care of updating the component automatically as the application’s state changes.

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:

cd directory-name

Then just start up the application with the given command:

npm start

and you are good to go! 

Hello World

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

Leave a Comment