Kent C. Dodds 12/1/2018

React Hooks: What's going to happen to my tests?

Read Original

This article addresses a common concern when migrating to React Hooks: what happens to existing tests? It explains that tests relying on component instances (like `.instance()` or `.state()` in Enzyme) will break. It provides a solution by demonstrating how to write tests using React Testing Library that avoid implementation details, ensuring they continue to pass after refactoring a class component to a function component with Hooks.

React Hooks: What's going to happen to my tests?

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser