react-collection-helpers
Version:
React Collection Helpers Component
24 lines (22 loc) • 645 B
JavaScript
/* eslint-disable react/prop-types */
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import Find from '../Find';
storiesOf('Find', module).add('default (finds the first match)', function () {
return React.createElement(
Find,
{
collection: [{ id: 'a', name: 'apple', inStock: false }, { id: 'b', name: 'banana', inStock: true }, { id: 'c', name: 'carrot', inStock: true }],
predicate: function predicate(item) {
return item.inStock;
}
},
function (item) {
return React.createElement(
'div',
{ key: item.id },
item.name
);
}
);
});