storybook-addon-actions
storybook-addon-actions copied to clipboard
decorateAction not working as expected
So currently, if I do args => args.splice(0, 1)
still I will get an array. How can I just log the first element of that array ?
if I do
const firstArg = decorateAction([
args => args[0]
]);
In simpler terms how do I log firstTerm
instead of [firstTerm]
if my args
was [firstTerm, secondTerm, thirdTerm]
Hi @ritz078
Action decorators taking an array of arguments as input and returning an array is intentional. It'll be easier to write action decorators this way.
For your case, try decorating the action manually
const firstArg = name => {
const actionFn = action(name)
return (...args) => actionFn(args[0])
}