Sharing Components

TODO: Expand this.

Rules for sharing components:

  1. Strive not to share components which integrate framework-specific HOCs.
  2. Instead, make all components dumb and add a wrapper which passes props from your framework
  3. If possible use small functional components
  4. Bundle CSS with the component using react-css-modules; export the 'naked' and 'styled' component together.
  5. Bundle selectors with the component by default. These should be overridable within the 'naked' component

Process for sharing components across teams/products

  1. Build components using above rules
  2. Don't worry about making things abstract enough to share immediately
  3. When a team/product needs to integrate a component look at use cases and figure out data needed for component in each scenario.
  4. Generally, component should be able to be used in-place while selectors may need to be re-written