git clone https://github.com/tclain/click-outside-render-prop
cd click-outside-render-prop
# Run npm install and write your library name when asked. That's all!
npm install
Basically the same as tj/click-outside, but with a render prop flavour and written in typescript !
import ClickOutside from 'click-outside-render-prop'
export const App = () => {
return <ClickOutside onClickOutside={console.log}>
{({ref}) => (
<MyComponentWrapper ref={ref} />
)}
</ClickOutside>
}
npm t
: Run test suitenpm start
: Runnpm run build
in watch modenpm run test:watch
: Run test suite in interactive watch modenpm run test:prod
: Run linting and generate coveragenpm run build
: Generate bundles and typings, create docsnpm run lint
: Lints codenpm run commit
: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)