“Hello World” in React
What is React?
React is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is used to create a single-page web application which allows us to create reusable components.
Prerequisites for react
- HTML
- CSS
- JSX(Javascript XML) & Babel
- ES6 Fundamentals
- Node & NPM
As we start, we need a code editor for instance I am using VS Code and also I’ll recommend it to others as well due to its easy-to-use features and large number of extensions.
To initiate a react app we need to run the following command on terminal/CMD.
npx create-react-app app-name
After running the above command some files and folders will be created under the directory which will look like
Open App.js where you will find the main code to render the index.html
So, it’s time to run our react app for that we will use following command
which will open a tab on the web browser.
npm start
After running this command you will see the following output in the web browser
we can also change the content inside app.js file like printing hello world in browser
output will be
So, this was all about “Hello World” in React.
Thank you!