Is the ref argument available for all functions or class components?

  • Yes, for all components
  • No, only for class components
  • No, only for function components
The ref argument is only available for class components in React. Function components do not have an instance, so refs cannot be attached to them. Refs can be attached to DOM elements, class components, and functional components that are created using the forwardRef() method.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *