UNPKG

@render-props/choices

Version:

A state container which provides an interface for making selections from a group of choices. The `Choices` component itself is a context provider which can be used with the `Choice` and `ChoicesConsumer` components for deep-tree selections. It does not ha

15 lines (12 loc) 267 B
import memoize from 'fast-memoize' import {callIfExists} from '@render-props/utils' export default memoize( cb => ({addItem, deleteItem, items}) => callIfExists( cb, { selections: items, select: addItem, deselect: deleteItem } ) )