Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://fb.me/react-with-addons-0.14.7.min.js"></script>
<script src="https://fb.me/react-dom-0.14.7.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div class="main-container"></div>
</body>
</html>
 
class Container extends React.Component {
   constructor(props){
     super(props);
   }
   
   componentDidMount(){
     console.log('componentDidMount', this.props.children);
     
     React.Children.forEach(this.props.children, (child, index)=>console.log(ReactDOM.findDOMNode(child)))
   }
   
   render(){
     return (
       <div>{this.props.children}</div>
     );
   }
}
ReactDOM.render(
  <Container>
    <div>hello</div>
  </Container>, 
  document.querySelector('.main-container')
);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers