You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm having a hard time writing the test code with react-hooks-testing-library.
Can you help me?
I'm sorry for my poor English.
version
"react-test-renderer": "^18.1.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react-hooks": "^8.0.0",
code
import{QueryClient,QueryClientProvider}from'react-query';import{renderHook}from'@testing-library/react-hooks';import{useGetDataQuery,GetDataQueryType}from'codegen/generated/graphql';importgraphqlRequestClientfrom'utils/graphqlRequestClient';constqueryClient=newQueryClient();constwrapper=({ children }: {children: ReactChild})=>(<QueryClientProviderclient={queryClient}>{children}</QueryClientProvider>);const{ result }=renderHook(()=>useGetDataQuery<GetDataQueryType>(graphqlRequestClient,{}),{
wrapper
});
It looks like you are trying to use React 18 (given the version of react-test-renderer. Is that correct?
This package is not going to support React 18 and you should rather import renderHook from the latest version of @testing-library/react. Check out their docs for more details.
Hi, I'm having a hard time writing the test code with react-hooks-testing-library.
Can you help me?
I'm sorry for my poor English.
version
code
run
error
The text was updated successfully, but these errors were encountered: