(React+TypeScript實戰篇)二.ReactHook

概念:hook是react16.8新增特性。它可以讓你在不編寫class的情況下使用state以及其他的React特性。   一.useState 說明:useState---組件狀態管理鉤子     useState使函數組件能夠使用state 1.基本使用規則 const [state, setState] = useState(initState);     ·state是要設置的狀態  
相關文章
相關標籤/搜索