storybook-fetch-addon
Storybook addon for fetching data from api
Install
npm i --save-dev storybook-fetch-addon
Setup
// In addons.js ;
// In config.js ;; ;
API
fetchSingle
(id, component, defaultValue) => Component
- id: string that identifies the item.
- component: React component that will be passed the fetched props.
- defaultValue: optional string that will be used as default value for fetching data.
fetchList
(items, component) => Component
- items: array of id/defaultValue pairs. Default value is optional.
- component: React component that will be passed the fetched props for all items.
Example
; ;