- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
Closed
Description
#25 was merged, but I forgot to add the related documentation. TODO :)
Draft:
Writing usage examples
The examples are extracted from markdown code blocks. They can use any components defined on the page (all the components are exposed as global variables) without requiring them. If you need anything else, you can require it just like you would in an ordinary .js file. Here's a markdown example:
Simple example:
    <Message data={ {content: 'Hello world'} } />
More complex example:
    var mockData = require('./mocks');
    <Message data={ {content: 'Hello world'} } />
Note that for mock data, it's often a good idea to use the same mocks in the unit tests too.
If you need more complex demos, you can even use React.createClass right in your code examples, but it's often a good idea to define them in a separate MyComponentDemo.js file instead and then just require them in markdown.