I am getting this error while using hooks.
This is related code.
const market = useContext(MarketContext);
useEffect(() => {
nav.items[1] = {
name: 'Market',
url: '/market',
icon: 'icon-speedometer',
badge: {
variant: market == "Live" ? "primary" : "secondary",
text: market,
}
};
}, market)
Can you provide a codesandbox sample instead?
You probably meant to pass [market]
rather than market
as useEffect
argument.
I'll close but I'm sending https://github.com/facebook/react/pull/15018 to add a warning for this.
Most helpful comment
You probably meant to pass
[market]
rather thanmarket
asuseEffect
argument.