Skip to content

Commit 01dd2d7

Browse files
committed
Add a blog post about hooks
1 parent 0869823 commit 01dd2d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: React Hooks Are Supported
3+
author: Alex Krolick
4+
authorURL: http://github.com/alexkrolick
5+
---
6+
7+
[Hooks have been released in React 16.8](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks)
8+
and they are supported out of the box by `react-testing-library`!
9+
10+
Because `react-testing-library` only uses the external interface of your React
11+
components, hooks work right away! If you rewrite a class component with hooks
12+
your tests should still pass.
13+
14+
For unit testing custom hooks, we've also added a `testHook` utility. Check out
15+
the [docs for `testHook`](/docs/react-testing-library/api#testhook). Thanks to
16+
[@donavon](https://github.com/donavon) for the PR.

0 commit comments

Comments
 (0)