JSFiddle - React, Tailwind, and code Playground
by nishant1391
HTML
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
JavaScript
class Hello extends React.Component {
state = {
name: this.props.initialName
}
change(e) {
this.setState({ name: e.target.value });
}
componentDidMount
render() {
const { name } = this.state;
return (
<div>
Name: <input value={name} onChange={this.change.bind(this)} /><br/>
Hello {name}!
</div>
);
}
}
ReactDOM.render(
<Hello initialName="World"/>,
document.getElementById('container')
);