Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import React, { Component } from "react";
  2. class MovieButton extends Component {
  3. constructor() {
  4. super();
  5. this.state = { buttonText: "Click to purchase movie tickets" };
  6. this.handleClick = this.handleClick.bind(this);
  7. }
  8. handleClick() {
  9. this.setState(() => {
  10. return { buttonText: "Enjoy your movie!" };
  11. });
  12. }
  13. render() {
  14. const { buttonText } = this.state;
  15. return <button onClick={this.handleClick}>{buttonText}</button>;
  16. }
  17. }
  18. export default MovieButton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement