Remplace decorate with decorateAction

On version @storybook/addon-actions@3.4.3 `decorate` is undefined but I found that `decorateAction` is the method I was looking for.
This commit is contained in:
Fabian Vilers 2018-05-07 17:26:17 +02:00 committed by GitHub
parent c25731ff15
commit 83e158f97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,14 +71,14 @@ storiesOf('Button', module)
If you wish to process action data before sending them over to the logger, you can do it with action decorators.
`decorate` takes an array of decorator functions. Each decorator function is passed an array of arguments, and should return a new arguments array to use. `decorate` returns a object with two functions: `action` and `actions`, that act like the above, except they log the modified arguments instead of the original arguments.
`decorateAction` takes an array of decorator functions. Each decorator function is passed an array of arguments, and should return a new arguments array to use. `decorateAction` returns a object with two functions: `action` and `actions`, that act like the above, except they log the modified arguments instead of the original arguments.
```js
import { decorate } from '@storybook/addon-actions';
import { decorateAction } from '@storybook/addon-actions';
import Button from './button';
const firstArg = decorate([args => args.slice(0, 1)]);
const firstArg = decorateAction([args => args.slice(0, 1)]);
storiesOf('Button', module).add('default view', () => (
<Button onClick={firstArg.action('button-click')}>Hello World!</Button>