Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2020 11:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save alexmochu/c719b2eb47d808edaea7cdb29c9e1b2f to your computer and use it in GitHub Desktop.
Counter Component
import React from 'react';
import './App.css';
const Counter = ({ value, onIncrement, onDecrement, onIncrementAsync }) =>
<button onClick={onIncrementAsync} className="button">
Increment after 1 second
{' '}
<button onClick={onIncrement} className="button">
+ Increment
{' '}
<button onClick={onDecrement} className="button">
- Decrement
<hr />
Clicked: {value} times
export default Counter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment