Enough React

Work In Progress

2020.04.10 React version is v16.13.1.

Writing HTML in JS. In JSX, Interpolation happens in {}.

const className = 'quote'
const children = 'Quote'
<div className={className}>{children}</div>

will compile into React.createElement(...)

Use prop-types for runtime validation of React Components

function Greet(name) {
    <div>Hello, {name}</div>

Greet.propTypes = {
  name: PropTypes.string,
  name: PropTypes.string.isRequired,

prop-types not runs on production. You need to install babel-plugin-transform-react-remove-prop-types to remove prop-types code from source.