'Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). To locate the bad setState() call inside `Login` [closed]

While I'm trying to reload in login or registration page it just gives me this following kind error but while taking in cloud this error leave, is this happen only in localHost case or something?



Solution 1:[1]

This warning was introduced since React V16

If you are using functional components you could wrap the setState call into useEffect.

// example
useEffect(() => {
// here
 },[]);

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 ParsaJ