mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-02 05:03:44 +08:00
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:
parent
c25731ff15
commit
83e158f97f
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user