-
-
Notifications
You must be signed in to change notification settings - Fork 311
Closed
Description
I'd like for it to be ok to have multiple exports in my interface. I tend to do this sort of thing:
import React from 'react'
import { connect } from 'react-redux'
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 const mapStateToProps = state => ({name: state.name})
export default connect(mapStateToProps)(Docs)This makes it easier to unit-test my redux state-mapper & standalone Component (without redux) and allows me to make storybook stories that don't need redux (I just hand them a snapshot of the relevant state-pieces in the story) while still being really easy to work with in my redux app.
If I run react-docgen on the above file, I get this error:
Error with path "Docs.js": Error: Multiple exported component definitions found.
Error: Multiple exported component definitions found.
If I comment out those and loop over the definitions, I get great output:
{"description":"A dumb component that says \"hello\"","methods":[],"props":{"name":{"type":{"name":"string"},"required":false,"description":"the name of the person to say \"hello\" to","defaultValue":{"value":"'World'","computed":false}}}}Does this part serve a purpose that makes this solution not a good one? I have a feeling I am missing some key part of the original functionality here.
Metadata
Metadata
Assignees
Labels
No labels