Ref Hooks
Refs let a component hold some information that isn’t used for rendering, like a DOM node or a timeout ID. Unlike with state, updating a ref does not re-render your component. Refs are an “escape hatch” from the React paradigm. They are useful when you need to work with non-React systems, such as the built-in browser APIs.
useRef
declares a ref. You can hold any value in it, but most often it’s used to hold a DOM node.
useImperativeHandle
lets you customize the ref exposed by your component. This is rarely used.
function Form ( ) {
const inputRef = useRef ( null ) ;
// ...
If you want to change selection, open document below and click on "Move attachment"
Built-in React Hooks – Reactonent can pass the current UI theme to all components below, no matter how deep. useContext reads and subscribes to a context. function Button() { const theme = useContext(ThemeContext); // ... <span>Ref Hooks Refs let a component hold some information that isn’t used for rendering, like a DOM node or a timeout ID. Unlike with state, updating a ref does not re-render your component. Refs are an “escape hatch” from the React paradigm. They are useful when you need to work with non-React systems, such as the built-in browser APIs. useRef declares a ref. You can hold any value in it, but most often it’s used to hold a DOM node. useImperativeHandle lets you customize the ref exposed by your component. This is rarely used. function Form() { const inputRef = useRef(null); // ... Effect Hooks Effects let a component connect to and synchronize with external systems. This includes dealing with network, browser DOM, animations, widgets written using a different UI Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details