react-trigger
v1.0.0
Published
A utility component to trigger a function as child in response to react events
Downloads
2
Readme
react-trigger
A utility component to trigger a function as child in response to react events
Install
yarn add react-trigger
Usage
import React from 'react'
import Trigger from 'react-trigger'
// show A for 1 second whenever Trigger gets updated
class Example extends React.Component {
render() {
return (
<Trigger onUpdate duration={1000}>
{(trigger) => {
return trigger ? <div className="A">A</div> : <div className="B">B</div>
}}
</Trigger>
)
}
}
License
MIT © spredemann