#How to clean decorator specific args from context so that those are not to be forwarded to story?

2 messages · Page 1 of 1 (latest)

eternal loom
#

I have component which is using spread syntax to add props to the component. When I'm using decorator which also takes some args, these args are also included to the story component. I would like to clear those in my decorator.

fallow hazel
#

Hi! You can manipulate args in your decorator like so:

const withManipulatedArgs = (story, { args, ...context }) => {
  const { decoratorSpecificArg, ...restArgs } = args;
  // Do something with `decoratorSpecificArg`
  return story({ args: restArgs, ...context });
}