Skip to content

jjeshwani/click-counter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple example of click counter

you can check it out here


class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {value: 0};
        this.buttonClicked = this.buttonClicked.bind(this);
    }

    buttonClicked() {
        this.setState({value: this.state.value + 1});
    }

    render() {
        return (
            <div>
                <div className="displayedNumber">{this.state.value}</div>
                <button type="button" class="btn btn-primary btn-lg" onClick={this.buttonClicked}>Count me!</button>
            </div>
        );
    }
}

ReactDOM.render(
    <App/>,
    document.getElementById('root')
);

export default App;

To run on http://localhost:3000:

  • $ yarn start

About

Click counter my example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.9%
  • HTML 11.6%
  • CSS 3.5%