In a React
project Im using react-router-dom version 5.2.0
. I want to navigate trough pages and components programmatically by calling history.push(path)
. It seems navigation works but I get a warning:
Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state
As I understand, the push functionality is setting state in render phase, but I don't know how to solve the problem.