Skip to content

Instantly share code, notes, and snippets.

@cctoni
Created February 16, 2019 14:34
Show Gist options
  • Select an option

  • Save cctoni/27e760dc5f50c171e9125c9831e0c26a to your computer and use it in GitHub Desktop.

Select an option

Save cctoni/27e760dc5f50c171e9125c9831e0c26a to your computer and use it in GitHub Desktop.
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