Created
December 11, 2018 01:40
-
-
Save victors1681/aa02e93bbac88618dadc9fee2c800cc9 to your computer and use it in GitHub Desktop.
This file contains 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 from "react"; | |
import "./Counter.scss"; | |
export default class Counter extends React.PureComponent { | |
state = { | |
counter: 0 | |
}; | |
increaseCounter = () => | |
this.setState(prevState => ({ counter: prevState.counter + 1 })); | |
render() { | |
return ( | |
<div className="counter-wrapper"> | |
<h1 className="counter-header">This is my counter</h1> | |
<p className="counter-result">Counter is: {this.state.counter}</p> | |
<button className="counter-button" onClick={this.increaseCounter}> | |
Increase | |
</button> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment