import React from 'react'; import classNames from 'classnames'; interface Props { active: boolean; onClick: any; } interface State { active: boolean; } export class SessionToggle extends React.PureComponent { public static defaultProps = { onClick: () => null, }; constructor(props: any) { super(props); this.clickHandler = this.clickHandler.bind(this); const { active } = this.props; this.state = { active: active, }; } public render() { return (
); } private clickHandler(e: any) { this.setState({ active: !this.state.active, }); if (this.props.onClick) { e.stopPropagation(); this.props.onClick(); } } }