Comments (3)
Can you also try:
const Button = ({text, onClick}) => (
<button onClick={onClick}>{text}</button>
);
Button.propTypes = {
text: PropTypes.string,
onClick: PropTypes.func
}
export Button
I think it might be because you're exporting an inline declaration so that proptypes are never applied.
from babel-plugin-react-docgen.
I don't think export Button
is valid syntax, you can only export it as named or default, i.e. export {Button}
or export default Button
, which works fine.
https://github.com/storybooks/babel-plugin-react-docgen/blob/4b10e9ba43f560ef6c753f0df496e3e5db8d93a5/src/index.js#L106
As you can see, it checks explicitly for specifiers
on ExportNamedDeclaration
, and if you have an inline export like export const Button = () => ...
the specifiers
will actually be an empty array.
from babel-plugin-react-docgen.
I see. Do you mind submitting a PR with a fix?
Thanks!
from babel-plugin-react-docgen.
Related Issues (20)
- [Bug] docgen works with start-storybook but not build-storybook
- [Question] babel-plugin-react-docgen-typescript alternatives ? HOT 1
- Are we open to changing the test file names? HOT 1
- Does not work in my case if I use the babel configuration in webpack HOT 2
- "Property value expected type of" error for an unnamed function HOT 3
- Update to babel 7? HOT 1
- If using reacts injectIntl to wrap component __docgenInfo is undefined HOT 2
- Error: Cannot find module 'recast' HOT 6
- [react-docgen]Smartknobs is not showing up
- Does not work with `class` Components HOT 12
- Not working with `forwardRef` wrapped components HOT 7
- How to docgen for an npm package? HOT 1
- Upgrade to [email protected] HOT 11
- The issue with forwardRef Component HOT 2
- React.createRef could breaking generating doc
- Cannot define custom resolver HOT 1
- Cannot pass Babel parser options to react-docgen
- Update `actualNameHandler` to remove FB patent license
- "Component".__docgenInfo no available on 4.2.0 HOT 5
- Dependency Version Update (react-docgen) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-react-docgen.