Various React components
Stateless components - purely functional
No need to implement constructor then.
Stateless components - purely functional
No need to implement constructor then.
Declarative
Component-based
encapsulate behaviors into small units called Components
Components are made of elements.
Components enable us to break down the entire UI in to smaller reusable pieces.
can have private states to control.
Only class components can store states.
Element
smallest building blocks is elements.
Basic structure for a component
1 | import React, { Component } from 'react'; |
Every parameter pass to the component is under props
.
If one component export the default one, there is no need to enclose import component name with braces, otherwise error occurs.
JSX: wrapped React Component expression
Handling events like handling DOM elements