What are the possible return types of render method?

Below are the list of following types used and return from render method,

  1. React elements: Elements that instruct React to render a DOM node. It includes html elements such as <div/> and user defined elements.
  2. Arrays and fragments: Return multiple elements to render as Arrays and Fragments to wrap multiple elements
  3. Portals: Render children into a different DOM subtree.
  4. String and numbers: Render both Strings and Numbers as text nodes in the DOM
  5. Booleans or null: Doesn't render anything but these types are used to conditionally render content.

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter