'react useEffect is not getting called in chrome extension app when extension is opened
I just started with react and chrome extension. I am creating an extension using reactjs
I have a Home component in which I am using useEffect hook, expecting to be called whenever component will be loaded.
code
useEffect(() => {
onLoad();
}, []);
function onLoad() {
console.log("loading");
const userLoggedIn = AuthService.isUserLoggedIn();
if (!userLoggedIn) {
console.log("User not logged in");
props.history.push("/login");
window.location.reload();
}
}
but this is not working in extension. Is extension not reloading the component when i open the extension? is there any solution for this..
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
