1.0.0 • Published 7 years ago

toggle-class-on-prop-change v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Toggle Class On Prop Change

Travis npm package Coveralls

A component that toggles a class of its children when a prop changes.

Useful when you have real-time applications and want to show a part of the component got updated.

<tbody>
  {this.state.teams.map(team => {
    return (
      <ToggleClassOnPropChange team={team} key={team.name} className="yellow" elapsedTime={500}>
        <tr>
          <th>{index + 1}</th>
          <th>{team.name}</th>
          <th>{team.points}</th>
        </tr>
      </ToggleClassOnPropChange>
    );
  })}
</tbody>

Everytime team prop passed to ToggleClassOnPropChange changes, the yellow class is added to the tr and removed 500ms after.

Table

Special thanks to

Missing

  • Tests
  • Tests
  • Tests
  • Tests
  • Tests
  • Tests
  • More tests