I have three component parent and 2 childs:
import React from 'react';
import FirstChild from './FirstChild';
import SecondChild from './SecondChild';
export default class ComponentName extends React.Component {
render() {
return (
<div>
<h1>ComponentName</h1>
<div id="renderChildHere">
<FirstChild />
</div>
<button onClick={this.clickHandler}>Replace FirstChild with SecondChild</button>
</div>
);
}
clickHandler() {
???
}
}
The FirstChild is initially rendered. How do I unmount it and mount the SecondComponent in the #renderChildHere Dom element?
I use React 0.13.3 and Flux without third-party addons.