Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from "react";
- class MovieButton extends Component {
- constructor() {
- super();
- this.state = { buttonText: "Click to purchase movie tickets" };
- this.handleClick = this.handleClick.bind(this);
- }
- handleClick() {
- this.setState(() => {
- return { buttonText: "Enjoy your movie!" };
- });
- }
- render() {
- const { buttonText } = this.state;
- return <button onClick={this.handleClick}>{buttonText}</button>;
- }
- }
- export default MovieButton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement