You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a situation where I set the default namespace as an argument of useTranslation to get t and monitor it with useEffect, I found that when I call asynchronous functions such as setTimeout in useEffect, the function keeps being called infinitely.
Here is the reproduction code.
importuseTranslationfrom'next-translate/useTranslation'import{ReactElement,useEffect,useState}from'react'exportdefaultfunctionI18nTest(): ReactElement{const{ t }=useTranslation('common')const[text,setText]=useState('')useEffect(()=>{constts=setTimeout(()=>{setText(newDate().toISOString())},1000)return()=>clearTimeout(ts)},[t])return(<div>{text}</div>)}
In a situation where I set the default namespace as an argument of
useTranslation
to gett
and monitor it withuseEffect
, I found that when I call asynchronous functions such assetTimeout
inuseEffect
, the function keeps being called infinitely.Here is the reproduction code.
Is this the expected behavior?
Environments
The text was updated successfully, but these errors were encountered: