Components

Components

2022/02/26 (增加連結)

Components

在React裡,有兩種component:class component及functional component,在React 16.8之前,class component是stateful component,也就是每個component裡有自己的state,functional component是stateless component,在React 16.8之後,functional component可利用hook來處理state,所以,functional component就再也不是stateless component了。

State

Props

Functional components vs. class components

Class components

Communication

Functional components

Higher order components

Higher-order functions

Web Components

Patterns

Compound Component

Flexible Compound Components

Provider

Composition

Container components

Pure components

Controlled Components vs. Uncontrolled Components