Saturday, 5 October 2024

Built-in React APIs

  •  CreateContext lets you define and provide context to the child components. Used with useContext.
  • forwardRef lets your component expose a DOM node as a ref to the parent. Used with useRef.
  • lazy lets you defer loading a component’s code until it’s rendered for the first time.
  • memo lets your component skip re-renders with same props. Used with useMemo and useCallback.
  • startTransition lets you mark a state update as non-urgent. Similar to useTransition.
  • act lets you wrap renders and interactions in tests to ensure updates have processed before making assertions.

No comments:

Post a Comment