Login
Remember
Register
Ask a Question
What are the possible return types of render method in ReactJS?
0
votes
asked
Nov 2, 2023
in
ReactJS
by
AdilsonLima
What are the possible return types of render method in ReactJS?
reactjs-interview-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Nov 2, 2023
by
AdilsonLima
Below are the list of following types used and return from render method,
React elements:
Elements that instruct React to render a DOM node. It includes html elements such as
<div/>
and user defined elements.
Arrays and fragments:
Return multiple elements to render as Arrays and Fragments to wrap multiple elements
Portals:
Render children into a different DOM subtree.
String and numbers:
Render both Strings and Numbers as text nodes in the DOM
Booleans or null:
Doesn't render anything but these types are used to conditionally render content.
...