0.1.1 • Published 7 years ago

react-laboratory v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

This is experimental, not meant for public use


react-laboratory

Render documentation and prop combinations automatically from React components

How Does It Work?

It uses your component's propTypes and defaultProps to generate documentation and examples of your components with different prop combinations

Getting Started

Add react-examples to your project's dependencies

$ yarn add react-examples

Pass an array of components to ReactExamples, where each of the components has propTypes and defaultProps defined

import React from 'react'
import ReactDOM from 'react-dom'
import ReactExamples from 'react-examples'
import CoolComponent1 from './components/CoolComponent1'
import CoolComponent2 from './components/CoolComponent2'

ReactDOM.render(
  <ReactExamples components={[
    CoolComponent1,
    CoolComponent2,
  ]} />,
  document.getElementById('root')
)

Ensure that your production build is using NODE_ENV of development so that the propTypes and defaultProps will be available when you deploy

Notes

Because react-examples requires being deployed in a development mode, it is only recommended to be used for creating a documentation app, not for a user facing app

Contributing

See CONTRIBUTING.md

0.1.1

7 years ago

0.1.0

7 years ago