1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Fix the "not wrapped in act(...)" warning when testing Custom Hooks

    reactReact

    Any time your test interacts with a React component in a way that results in a state update, you need to make sure you wrap that interaction in an act function call, otherwise you'll get the "not wrapped in act(...)" warning.

    In this lesson you'll learn how you can use act with @testing-library/react-hooks to avoid potential bugs in your custom React hooks.

    This is based on my blog post: Fix the "not wrapped in act(...)" warning