Subscribe Us

React JS | React Getting Started | Dark Watcher

 

React Getting Started

Run and Check

Run the React Application with this command:

A new browser window will pop up, if it does't then go on http://localhost:3000/. Check if it is showing the same page:

If it's the same page then you are good to go! 

Hello World

For this first you need to navigate to src/App.js, it will look like: 

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;

Whatever you put in return will be rendered as HTML on the page, you can change it like: 

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

Note: Remember to wrap whole return value in an HTML element as you can't return multiple elements but you can return multiple elements in one element.

Page would look like this:


Post a Comment

0 Comments