Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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)



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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: