I have a simple useEffect function setup with the brackets like so:
useEffect(() => {
console.log('hello')
getTransactions()
}, [])
However when I run my app, it prints two hellos in the console. Any idea why?
Even if I add something like this, two hellos print still.
const [useEffectCalled, setUseEffectCalled] = useState<Boolean>(false)
useEffect(() => {
console.log('hello')
if (!useEffectCalled) {
getTransactions()
}
setUseEffectCalled(true)
}, [])
Thanks to Joel Hager I was able to get it working by editing by next.config.js
to
const nextConfig = {
reactStrictMode: false,
};
and restarting my app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With