If I understand correctly, useEffect without any dependencies will be fired on each rerender. If that's the case then we would do unnecessary calls to Kratos, because useEffect will be fired again after we call setSession the first time.
Should we add an empty array [] as useEffect dependency so it fires only once? Or maybe there is some different reasoning as to why there are no dependencies in this useEffect?
If I understand correctly,
useEffect
without any dependencies will be fired on each rerender. If that's the case then we would do unnecessary calls to Kratos, becauseuseEffect
will be fired again after we callsetSession
the first time.https://github.com/ory/kratos-selfservice-ui-react-nextjs/blob/b3d26868f8eea281480b1ec5053ecab658ca5c19/pages/index.tsx#L19-L44
Should we add an empty array
[]
asuseEffect
dependency so it fires only once? Or maybe there is some different reasoning as to why there are no dependencies in thisuseEffect
?