SW
Maybe something like this might work for your case. // Button.jsx const Button = (props)=> ( <button type="button" onClick={props.handleClick}>{JSON.stringify(props.txt)}</button> ); export default Button; state = { isOn: false }; handleClick() { this.setState({isOn: !this.state.isOn}) } render() { const { isOn } = this.state; return ( <div> <Button txt={this.state.isOn}, handleClick={this.handleClick} /> <span>{isOn ? "Hello" : "Bye"}</span> </div> ); }