React component testing has dramatically improved over the past year. A year ago I wrote a small post that used Enzyme which helped supply much needed tooling around react component testing and isolated component testing with shallow Rendering.
I tweeted the other day about image onError react component. The below tweet and attached component are a great start.
Over the past few months I've been using a library called recompose. It claims to be
a react utility belt for function components and higher-order components, and it fulfills this claim exceedingly well!
I've previously talked about stateless functional components and how they have helped keep components small and more reusable. Functional components really shine with the help of recompose! I've been able to extract computed properties, display logic, and overall optimize my code and views!
Simple recompose example
With react v0.13 they introduced 'shallow rendering', all basic html inside a component is rendered and no sub components are rendered. We now have the power to run unit tests in node without the need for a 'DOM'.
Shallow Rendering takes a component and renders it 'one level deep' and will not render sub components. This allows unit tests to keep focus on their specific component.