How to define multiple elements inside JSX ?

 Posted by Rajnilari2015 on 12/6/2015 | Category: JavaScript Interview questions | Views: 243 | Points: 40
Answer:

The Render method of ReactDOM returns a single node. We need to wrap the multiple child elements inside a parent element say DIV and retur a single node to the Render method. e.g.

<script type="text/babel">

ReactDOM.render(
<div>
<h1>Message from RNA Team - "Welcome to ReactJS World"</h1>
<b>Bold this text</b>
</div>,
document.getElementById('mainContainer')
);
</script>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response