Created
February 16, 2019 14:34
-
-
Save cctoni/27e760dc5f50c171e9125c9831e0c26a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import { IceCream } from "react-kawaii"; | |
| class Four extends Component { | |
| state = { | |
| mood: "sad" | |
| }; | |
| changingMood = () => { | |
| this.setState({ mood: "sad" }); | |
| setTimeout(() => { | |
| this.setState({ mood: "excited" }); | |
| }, 5000); | |
| }; | |
| componentDidMount() { | |
| this.changingMood(); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <h2>Task No.4</h2> | |
| <p>After counting down 5s i will become excited.</p> | |
| <p> | |
| <button onClick={this.changingMood}>Restart Timer</button> | |
| </p> | |
| <IceCream size={200} mood={this.state.mood} color="#FDA7DC" /> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default Four; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment