React 入門 4 - Hooks: useState
在第0篇有提到state在React的重要性:
state 是用來驅動component更新(re-evaluate),並且根據修改的地方重新渲染(re-render)畫面。
在正式說明state之前,有個關於function component的重要性質必須提及:
重新渲染(re-render)畫面,代表重新呼叫(call)function component,所以component裡面的變數等都會重新建立
從JavaScript語法的角度試想一下,每次呼叫函式(function),函...
urlun0404.hashnode.dev2 min read