Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Performance Hooks

A common way to optimize re-rendering performance is to skip unnecessary work. For example, you can tell React to reuse a cached calculation or to skip a re-render if the data has not changed since the previous render.

To skip calculations and unnecessary re-rendering, use one of these Hooks:

  • useMemo lets you cache the result of an expensive calculation.
  • useCallback lets you cache a function definition before passing it down to an optimized component.
 function TodoList ( { todos , tab , theme } ) { 
const visibleTodos = useMemo ( ( ) => filterTodos ( todos , tab ) , [ todos , tab ] ) ;
// ...
}

Sometimes, you can’t skip re-rendering because the screen actually needs to update. In that case, you can improve performance by separating blocking updates that must be synchronous (like typing into an input) from non-blocking updates which don’t need to block the user interface (like updating a chart).

To prioritize rendering, use one of these Hooks:

  • useTransition lets 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.
If you want to change selection, open document below and click on "Move attachment"

Built-in React Hooks – React
useLayoutEffect fires before the browser repaints the screen. You can measure layout here. useInsertionEffect fires before React makes changes to the DOM. Libraries can insert dynamic CSS here. <span>Performance Hooks A common way to optimize re-rendering performance is to skip unnecessary work. For example, you can tell React to reuse a cached calculation or to skip a re-render if the data has not changed since the previous render. To skip calculations and unnecessary re-rendering, use one of these Hooks: useMemo lets you cache the result of an expensive calculation. useCallback lets you cache a function definition before passing it down to an optimized component. function TodoList({ todos, tab, theme }) { const visibleTodos = useMemo(() => filterTodos(todos, tab), [todos, tab]); // ... } Sometimes, you can’t skip re-rendering because the screen actually needs to update. In that case, you can improve performance by separating blocking updates that must be synchronous (like typing into an input) from non-blocking updates which don’t need to block the user interface (like updating a chart). To prioritize rendering, use one of these Hooks: useTransition lets 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. 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 informatio


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.