react-clap
v0.0.1
Published
Simple clap component similar to one found on medium.com
Readme
react-clap
Simple clap component for react mimicking the behaviour of clap button on medium.com.

Installation
npm install react-clapUsage
import CardTree from 'react-clap';Render it as show below
<ClapComponent
popupClapCount={this.state.clapsCount}
maxClapCount={50}
onChange={(newClapCount, diff) => {
this.setState({
clapsCount: newClapCount,
totalClapCount: this.state.totalClapCount + diff,
});
}}
/>Props
popupClapCount: (Required)The clap count to be used by the component. You can set it to any number. Make sure to update the component with new clap counton change. Default: nonemaxClapCount: (Optional)Max Clap count that the component can accumulate. Default: 50onChange(newClapCount, diff): Function that will be called whenclapstops.newClapCountwill be the clap count accumulated by the component.diffis the value of difference between thepropertypopupClapCountand the componentspopupClapCount. Note:diffwould show wrong value when you don't send the new property on change. In the above example's onChange, the clapcount is updated in state and sent as prop to the component.
Credits:
- “Clap” icon by Yamini Ahluwalia from the Noun Project.
- mo.js
