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
If a React component returns a portal created by createPortal from react-dom, Autodocs doesn’t retrieve the type information or JSDoc comments from the file.
ButtonPortal is the same component as Button, but the returned value is wrapped in createPortal. See the difference between Button/Docs and ButtonPortal/Docs
I found another workaround, which is to wrap the createPortal call with a fragment. I still wanted to give notice, because I scratched my head for a while before realizing what was different from my other components/stories.
Basically it looks like the component has to return a React.JSX.Element for Autodocs to work.
Describe the bug
If a React component returns a portal created by
createPortal
fromreact-dom
, Autodocs doesn’t retrieve the type information or JSDoc comments from the file.To Reproduce
https://stackblitz.com/edit/github-cj2wcx?file=src%2Fstories%2FButtonPortal.tsx
ButtonPortal
is the same component asButton
, but the returned value is wrapped increatePortal
. See the difference betweenButton/Docs
andButtonPortal/Docs
System
But it works the same way on Stackblitz
The text was updated successfully, but these errors were encountered: