Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Testing React?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/landonschropp-testing-react)
---
name: testing-react
description: Use when writing or modifying tests for React hooks.
---
# Testing React Hooks
Use `renderHook` and `act` from `@testing-library/react`. Don't write a probe component — `renderHook` is the affordance for testing a hook in isolation.
```tsx
import { useMyHook } from "./use-my-hook.ts";
import { act, renderHook } from "@testing-library/react";
const { result, rerender, unmount } = renderHook(() => useMyHook(arg));
expect(result.current).toBe(/* ... */);
```
`renderHook` needs DOM globals. A typical React project provides them through its configured test environment (jsdom or happy-dom), so no per-test setup is required.