Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- class Memes extends Component {
- constructor(props) {
- super(props);
- this.state = {
- hideMemes: false
- };
- this.showMemes = this.showMemes.bind(this);
- this.hideMemes = this.hideMemes.bind(this);
- }
- showMemes() {
- this.setState({ hideMemes: false });
- }
- hideMemes() {
- this.setState({ hideMemes: true });
- }
- render() {
- return (
- <div>
- <button type="button" onClick={this.showMemes} >
- Show Memes
- </button>
- <button type="button" onClick={this.hideMemes} >
- Hide Memes
- </button>
- {
- this.state.showMemes ? <h1>Memes</h1> : null
- }
- </div>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement