testing-library/react-hooks-testing-library

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

RonaldCast opened this issue · 1 comments

  • 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)
    })
})

This library does not and will not support react 18. See #831 (comment) for more information.