This is a well known problem in the React community but not easily noticeable. useEffect updates the state and the state calls useEffect. In this case, the call of useEffect fetches the network which can be detected in the network tab of any browser's developer tools.
I simply put passed an empty list as dependencies since we want the useEffect to be called only once (when page loads). Kotlin's useEffect has a deprecated overload, so I used an array of dynamics to force the compiler chose the up-to-date overload.
Thanks so much! We’ve completely overhauled this tutorial to be compatible with the latest version of the wrappers, which also fixes this! I appreciate y’all pointing it out.
This is a well known problem in the React community but not easily noticeable.
useEffect
updates the state and the state callsuseEffect
. In this case, the call ofuseEffect
fetches the network which can be detected in the network tab of any browser's developer tools. I simply put passed an empty list as dependencies since we want theuseEffect
to be called only once (when page loads). Kotlin'suseEffect
has a deprecated overload, so I used an array ofdynamic
s to force the compiler chose the up-to-date overload.