React Setup

First things first, where to start!

  • Install Node.js
  • Install yarn: brew install yarn
  • Run: yarn create react-app hello-world
  • Run: yarn start

Import React and ReactDOM

import React from 'react'
import ReactDOM from 'react-dom'

Render JSX into a DOM element

ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('root') );

Render Component into a DOM element

ReactDOM.render(
  <MyComponent />,
  document.getElementById('root')
);

Leave a Reply

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