Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import React, { Component } from 'react';
class ConcreteToggle extends Component {
constructor(props) {
super(props);
this.state = { isActive: false };
this.onToggle = this.onToggle.bind(this);
}
render() {
return (
<div>
<p onClick={this.onToggle}>title</p>
{ this.state.isActive && <p>content</p> }
</div>
);
}
onToggle() {
this.setState({ isActive : !this.state.isActive });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment