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

10 lines (9 loc) 245 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, }) )