addon-info: Component.__docgenInfo not defined.
See original GitHub issueI can’t get the “description” field to show up in the PropType table in my project. I worked on #1030 with @bigassdragon and we had it working when all was done.
I tried with both methods to add info, and .__docgenInfo is undefined in both.
I did this in my config.js:
import { configure, setAddon } from '@storybook/react'
import infoAddon from '@storybook/addon-info'
setAddon(infoAddon)
window.STORYBOOK_REACT_CLASSES = {}
function loadStories () {
require('../src/stories')
}
configure(loadStories, module)
and made stories that looked like this:
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withInfo } from '@storybook/addon-info'
import Docs from './Docs'
storiesOf('Docs', module)
.add('withInfo', withInfo('Heading here')(() => (<Docs name='David' />)))
.addWithInfo('addWithInfo', 'Heading here', () => (<Docs name='David' />))
and Docs.js looks like this:
import React from 'react'
import PropTypes from 'prop-types'
/** A dumb component that says "hello" */
export const Docs = ({name}) => (<div>Hello {name}</div>)
Docs.propTypes = {
/** the name of the person to say "hello" to */
name: PropTypes.string
}
Docs.defaultProps = {
name: 'World'
}
export default Docs
I tried class Docs extends React.Component style, too.
Still no “description” field in either story:

steps to reproduce:
npm i -g create-react-app @storybook/cli
create-react-app demo
cd demo
getstorybook
npm i -D @storybook/addon-info
Then I made changes, above.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
addon-info: Component.__docgenInfo not defined. · Issue #1762
I tried with both methods to add info, and .__docgenInfo is undefined in both. I did this in my config.js: import { configure ......
Read more >storybook-addon-react-docgen
A storybook addon to display react docgen info. ... If you are using @storybook/addon-docs then you do not need to set up docgen...
Read more >@esqimoe/react-docgen-typescript-loader - npm
Webpack loader to generate docgen information from TypeScript React components. The primary use case is to get the prop types table ...
Read more >@storybook/addon-storysource | Yarn - Package Manager
Angular: Fix "webpack_require.nmd is not a function issue" in Angular 15 #20043; CLI/React native: Fix addons template to import register instead of manager ......
Read more >storybook-addon-react-docgen/README.md - UNPKG
5, A storybook addon to display react docgen info. ... 25, If you are using `@storybook/addon-docs` then you do not need to set...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

export const Docs = ({name}) => (<div>Hello {name}</div>)doesn’t work unfortunately.If you delete
export, it should be okay. It’s a bug in https://github.com/storybooks/babel-plugin-react-docgen/issues/33 with the React component detection. Feel free to submit a PR, we basically parse the AST to figure out if its an exported React component before sending it off to docgen for parsing.Part of me wonders why we’re even parsing the AST of the files in the babel plugin because
react-docgenwill reparse it again. I’m not sure we gain much from the performance boost either. Anyway, that’s a whole separate issue.I made a PR to change the behavior of the resolver but as @danez pointed out, the resolver is actually configurable, and there are a few built in (maybe
findAllComponentDefinitionsdoes what I want?) I propose that we use that as the default, instead. I like the idea of the default storybook doc-resolver grabbing all the exported stuff, but then using it’s own “this is what this story is about” resolution to pick out the right doc object to actually show. I will do some experimentation with this and come back with a PR, if people like this idea.