FAST CODE:

fast-code

REACT is a powerfull framework that let you use others libraries too
Developed by Facebook its a great tool, lets start

DOWNLOADING REACT

you cant download react directly on the terminal with

npm i create-react-app

LET’S CREATE A REACT APP

Well to better undestand the concepts of react  what is a better way to create a web app with react???
So, first of let’s use a create-react-app command :

$create-react-app my-app
npx create-nw-react-app my-app // for nwjs development

This will install react, react-dom and react-scripts and also all the 3th party libraries that we need to run react!
So it’s gonna install :

  • A lightweight development server
  • Web Pack (to bundle the files)
  • Babel (for compiling javascript code)
  • Others tools

The good thing is that you don’t have to configure any of those in order to react to work, all the configuration is done for you!
But if you really really need to have a particular config you can always eject by running:

$ npm run eject

So Now we have running react app, if we go inside the folder and if we run the script we can see that everithing is working:

$ cd my-app
$ npm start

As you can see this will start a server in localhost:3000 and will open a page on that!

JSX AND BABEL

React use JSX (JavaScript XML) to render components and babel is its translator :

class App extends Component {
  render() {
    return (
//FROM HERE THIS IS JSX
      <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>
    );
  }
}