How does React Work?

React is a Javascript library created by Facebook. It creates a virtual DOM in memory. React Only changes what needs to change not complete page load which makes the application faster.

React JS latest version 17.0.2 (June 2021)

To use React in production, you need NPM and Node.js

Modify the React Application
As we install myreactproject in our last blog. Let’s modify that application.
Go to the myreactproject folder
open the file src/App.js

import logo from './logo.svg';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;

Change the HTML in this file and save it.

import logo from './logo.svg';
import './App.css';

function App() {
  return (
    <div className="App">
        <h1>Hello Amit!</h1>
    </div>
  );
}

export default App;

Let build the project using the below command

npm run build

npm start

Now you can check the changes as we did in HTML.

Leave a Reply

Your email address will not be published. Required fields are marked *