What are the possible return types of render method?

Posted by Prem Tiwari | Updated on

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.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers