ReactJS lifecycle method inside a function Component

前端 未结 8 535
一生所求
一生所求 2020-11-30 19:28

Instead of writing my components inside a class, I\'d like to use the function syntax instead.

How do I override componentDidMount, componentWillM

8条回答
  •  有刺的猬
    2020-11-30 19:58

    if you using react 16.8 you can use react Hooks... React Hooks are functions that let you “hook into” React state and lifecycle features from function components... docs

提交回复
热议问题