Vitest Fails with 'No MemoryRouter Export Defined' and 'useNavigate' Context Error in React-Router-Dom Mock #5667
Unanswered
kshahamplifire
asked this question in
Q&A
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, I am trying to do a unit test on a component and for whatever reason it just hangs up on this error:
This is my test. I have abbreviated the mockLoaderData so it doesn't take up space.
When I comment out the
MemoryRouter
, it then complains aboutuseNavigate
in a child component being inside a router despite the fact that I am mocking it to some capacity already.The component I am testing is set up as a route in my app:
Any help would be appreciate as far as what I can do to fix this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions