Skip to content

Getting not wrapped in act warning using renderHook #406

Closed
@orpheus

Description

@orpheus

https://codesandbox.io/s/async-surf-8ytrn?file=/src/hook.test.js

Here's a simplified example of a hook I'm using that makes an api call within the hook and also has some state management. Testing the hook from the outside, I have nothing to wrap in act.

I've tried a few of the solutions https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning and https://react-hooks-testing-library.com/reference/api#async-utilities but maybe I missed something.

Also the returned value isn't what I expect (it's still the default false). If I use the wait async utils, what would I wait for?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions