Statements (46)
Predicate | Object |
---|---|
gptkbp:instanceOf |
JavaScript library feature
|
gptkbp:allows |
Code reuse via custom hooks
|
gptkbp:announced |
October 2018
|
gptkbp:API |
Function-based API
|
gptkbp:cannotBeUsedWith |
React class components
|
gptkbp:category |
Performance optimization
Custom hooks State management Side effects Context API Refs |
gptkbp:customHooks |
User-defined hooks for code reuse
|
gptkbp:documentation |
https://react.dev/reference/react/hooks
|
gptkbp:enables |
Cleaner code structure
Easier testing of logic Functional programming in React Sharing logic between components |
gptkbp:firstReleased |
February 2019
|
gptkbp:hasRule |
Only call hooks at the top level
Only call hooks from React functions Do not call hooks inside loops, conditions, or nested functions |
https://www.w3.org/2000/01/rdf-schema#label |
React Hooks
|
gptkbp:introduced |
React team
|
gptkbp:introducedIn |
gptkb:React_16.8
|
gptkbp:license |
gptkb:MIT_License
|
gptkbp:mainHub |
useCallback
useContext useDebugValue useEffect useImperativeHandle useLayoutEffect useMemo useReducer useRef useState |
gptkbp:notAllowedIn |
Class components
|
gptkbp:purpose |
Enable state and lifecycle features in functional components
|
gptkbp:relatedTo |
gptkb:JavaScript
gptkb:React Web development |
gptkbp:replacedBy |
Class component lifecycle methods
Class component state |
gptkbp:requires |
React 16.8 or later
|
gptkbp:usedIn |
React functional components
|
gptkbp:bfsParent |
gptkb:React_Context
|
gptkbp:bfsLayer |
7
|