JSFiddle - React, Tailwind, and code Playground

by John Francis

HTML

<script src="https://unpkg.com/prop-types@15.5.10/prop-types.js"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="container"></div>

Babel + JSX

class Parent extends React.Component {  
 
  render() {
  	return (
    	<div>
    	  <h1>I am parent</h1>
        <Child></Child>
    	</div>
    );
  }
}


class Child extends React.Component {

	constructor(props){
  	super(props);
  	this.state={
    posts:[]
    }
  }
	
  render() {
  	if (this.state.posts) {
      return this.state.posts.mmmmaaaaapppp(x => <h1>{x}</h1>);
    }
  	return (
    	<div>
    	  <h1>I am child</h1>
    	</div>
    );
  }
  
  componentDidMount(){
		fetch("https://jsonplaceholder.typicode.com/posts").then((response) => {
      this.setState({posts: []});
    })
  }
}



ReactDOM.render(<Parent name="world"/>, document.getElementById('container'));