Skip to content

TypeError: Cannot read property 'current' of undefined. In React v18  #842

Closed
@RonaldCast

Description

@RonaldCast
  • react-hooks-testing-library version:^8.0.0"
  • react version: ^18.1.0
  • react-dom version (if applicable): ^18.1.0"
  • node version: 14.17.4
  • npm (or yarn) version: 6.14.14

Problem description:

I have this error in React v18.1.0, but in React v17.0.2 work good.

image

Code

This is my code that throws the error.

import { renderHook } from "@testing-library/react-hooks"
import useCounter from "../../hooks/useCounter"

describe("xxxxxxxxxxxxxxx", () => {

    test("xxxxxxxxxxxxxxxxxx", () =>{
        const r = renderHook(() => useCounter())

        console.log(r)
    })
})

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