react-bluekit icon indicating copy to clipboard operation
react-bluekit copied to clipboard

Handle multiple exports?

Open andrewcroce opened this issue 8 years ago • 2 comments

Seems one cannot export multiple components from a single module. Is this by design? For example, in TestModule.js:

import React from 'react'

export class ThingOne extends React.Component {
  render () {
    return (
      <div>Thing one here!</div>
    )
  }
}

export class ThingTwo extends React.Component {
  render () {
    return (
      <div>Thing two here!</div>
    )
  }
}

yields the error Error parsing component Test/Test.js: Multiple exported component definitions found. A single export works as expected.

Is there a pattern for multiple exports I should be aware of?

Thanks!

andrewcroce avatar Dec 28 '16 20:12 andrewcroce

It's not supported by react-docgen which is parsing components within BlueKit. Modules have to export a single component, and only that component is analyzed. https://github.com/reactjs/react-docgen#guidelines-for-default-resolvers-and-handlers

imtoo avatar Jan 02 '17 10:01 imtoo

carte-blanche had the same issue. They reference a solution for the same use case in react-styleguidist.

Maybe this could work here also?

sbkn avatar Mar 29 '17 14:03 sbkn