catho/quantum-storybook-ui

Remove props from component when AutoProps change prop to undefined

Closed this issue · 1 comments

In some cases it's important to remove props from the rendered component on preview panel.

Example:

toggle-error

  • On first render component have checked value equals undefined, so, its an uncontrolled component;
  • When checked is defined, the component on preview panel and on the code example receive true as a value, and, the component is now controlled;
  • When checked prop is removed the component on preview panel receive false but on code example panel the props is undefined, because its not present on code example, in this case, the component must receive undefined to be uncontrolled again.

So, we need to remove props (set as undefined) from the rendered component on preview panel.

Same as #7
Resolved issue