News for hackers. Stuff that matters.
Re:Unit testing React components without a DOM by masklinn on Monday June 15, 2015 @12:01PM (#9720183)
> Break down your React rendering into two steps: "state->JSON", then "JSON->DOM".

Er… that's exactly how React works in the first place, your "JSON" is react's "VDOM". The point of the shallow renderer is to perform a single level of rendering rather than recursively rendering all components to the final VDOM (so sub-components will appear as sub-components, not as their rendered vdom)

Re:Unit testing React components without a DOM by zenojevski on Monday June 15, 2015 @12:07PM (#9720233)
He means to preprocess your props+state into a simple dictionary, so that you have moved 90% of logic from `render()` to a different, more testable function.
Re:Unit testing React components without a DOM by zodiac on Tuesday June 16, 2015 @01:07AM (#9723930)
I think the JSON that drcode describes doesn't need to be DOM-like - it doesn't need to contain spans, divs etc. Look at the example he gave.