'In my react app Cannot update a component (`BrowserRouter`) while rendering a different component, how can I solve this error?

When I clicked the update stock button on my website .Website smoothly routes one route to another route but in the console, this error has occurred, I have tried but did not find the solution. Why this has happened



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source