Sharing Components
TODO: Expand this.
Rules for sharing components:
- Strive not to share components which integrate framework-specific HOCs.
- Instead, make all components dumb and add a wrapper which passes props from your framework
- If possible use small functional components
- Bundle CSS with the component using react-css-modules; export the 'naked' and 'styled' component together.
- Bundle selectors with the component by default. These should be overridable within the 'naked' component
Process for sharing components across teams/products
- Build components using above rules
- Don't worry about making things abstract enough to share immediately
- When a team/product needs to integrate a component look at use cases and figure out data needed for component in each scenario.
- Generally, component should be able to be used in-place while selectors may need to be re-written