You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain cases, autodocs doesn't add the JSDoc and argTypes from a React + Vite project. This seems to happen when a React component doesn't return a ReactElement.
Additional information
In my project, I have some components which don't return a ReactElement but something else instead (a string or ReactPortal for example).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
In certain cases, autodocs doesn't add the JSDoc and argTypes from a React + Vite project. This seems to happen when a React component doesn't return a
ReactElement
.Additional information
In my project, I have some components which don't return a
ReactElement
but something else instead (astring
orReactPortal
for example).Simple reproduction case in https://github.com/hongaar/storybook-test
Then add
Test.tsx
and
Test.stories.ts
We can observe JSDoc and argTypes are not populated by autodocs.
When we change
Test.tsx
to:We can observe JSDoc and argTypes are now correctly populated by autodocs.
It seems that returning a
string
(in example above) andReactPortal
(in my project) from a React component have the same behaviour.Is this behaviour I can fix with configuration or should this be considered a bug?
Create a reproduction
https://github.com/hongaar/storybook-test
Beta Was this translation helpful? Give feedback.
All reactions