Answer the question
In order to leave comments, you need to log in
React testing, I use act, writes that I don't use it, how to fix it?
To render the component I use this entry:
act(() =>
render(
<Router history={history}>
<Route path="/v/:id">
<SingleVideo/>
</Route>
</Router>
)
)
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question