Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load components conditionally in ReactJS

This is from a new starter of ReactJS. Unavailability of easily graspable resources has prompted me to knock at SO again. The issue is this. I have a React Component namely, RegisterAccount which when clicked shoots another component (a pop-up) allowing users to fill in the required details to register an account. Now once an account is successfully registered, I want to add the registered account as another component under RegisterAccount. How can I have this communication set up?

//In RegisterAccount <addAccount/> //pop-up <accountAdded/> //if account added, then show this component 
like image 664
5122014009 Avatar asked Jan 22 '14 08:01

5122014009


1 Answers

I'm new to React. I was also finding how. and I saw this article! It says like belows

render : function() {     return (         <div>         { true && <AddAccount /> }         { false && <AccountAdded /> }         </div>     ); } 
like image 172
Yongnam Jeong Avatar answered Sep 20 '22 07:09

Yongnam Jeong