Resource Hooks
Resources can be accessed by a component without having them as part of their state. For example, a component can read a message from a Promise or read styling information from a context.
To read a value from a resource, use this Hook:
function MessageComponent ( { messagePromise } ) {
const message = use ( messagePromise ) ;
const theme = use ( ThemeContext ) ;
// ...
}
If you want to change selection, open document below and click on "Move attachment"
Built-in React Hooks – Reactets you mark a state transition as non-blocking and allow other updates to interrupt it. useDeferredValue lets you defer updating a non-critical part of the UI and let other parts update first. <span>Resource Hooks Resources can be accessed by a component without having them as part of their state. For example, a component can read a message from a Promise or read styling information from a context. To read a value from a resource, use this Hook: use lets you read the value of a resource like a Promise or context. function MessageComponent({ messagePromise }) { const message = use(messagePromise); const theme = use(ThemeContext); // ... } Other Hooks These Hooks are mostly useful to library authors and aren’t commonly used in the application code. useDebugValue lets you customize the label React DevTools displays for you Summary
| status | not read | | reprioritisations | |
|---|
| last reprioritisation on | | | suggested re-reading day | |
|---|
| started reading on | | | finished reading on | |
|---|
Details