To create react projects, follow instructions mentioned on React’s official doc.
To use React and it’s virtual DOM, the modules need to be imported in the following :
import React from ‘react’;
import ReactDOM from 'react-dom';
To render something using ReactDOM:
NOTE: only single HTML tag is allowed in render function. Therefore, two tags were included inside one parent div tag.
let content = "Hello, World";
NOTE: only expressions can be used inside curly braces. Statement can’t be added inside render(). Therefore conditions checking and iterations can’t be done directly inside render function.
Sample React project can be found here.