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) 249 B
import memoize from 'fast-memoize' import {callIfExists} from '@render-props/utils' export default memoize(cb => ({addItem, deleteItem, items}) => callIfExists(cb, { choices: items, addChoice: addItem, deleteChoice: deleteItem, }) )