Important
If you are using React v0.13 you may want to install react-vdom v0.5.
The Idea
I wrote this handy little library for testing purposes: you can extract the vdom from a React component and test it against a JSON with simple tools like assert.deepEqual() and without a real DOM. The extracted vdom has the following type definition:
type Node = tag: string attrs: object<name value> children: undefined | null | Node | Array<Node>
If your component handle a private state, you can inject a state to test different configurations.
Basic example
var vdom = ; // a simple componentvar Counter = React; var json = ;console;
outputs
Inject a state
var state = count: 1;console;
outputs
Setup
npm install react-vdom
Api
element
a ReactElementstate
inject a state
Returns a JSON containing a synthetic VDOM.