fbredius/storybook

View on GitHub
docs/snippets/common/storybook-addons-api-makedecorator.js.mdx

Summary

Maintainability
Test Coverage
```js
// .storybook/my-addon/register.js

import { makeDecorator } from '@storybook/addons';

export makeDecorator({
  name: 'withSomething',
  parameterName: 'something',
  wrapper: (storyFn, context, { parameters }) => {
    // Do something with `parameters`, which are set via { something: ... }

    // Note you may alter the story output if you like. 
    // Although generally that's not advised.

    return storyFn(context);
  }
})
```