Different functions with the same name
See original GitHub issueDescription:
I got rerendering issue while use const { t } = useTranslation() of react-i18next. In my research, the inside of useTranslation hook used useState to store a getT function. Wrapping getT function inside useCallback hook could not prevent getting this message from WDYR
different functions with the same name
function getT() {
return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0]);
}
https://github.com/i18next/react-i18next/blob/master/src/useTranslation.js#L42-L45
setT(getT);
https://github.com/i18next/react-i18next/blob/master/src/useTranslation.js#L82
Could you please confirm that issue comes from react-i18next? Thanks 🙇🏻
Reproduction:
Repo: https://github.com/zcmgyu/react-i18next-rerender-issue
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top Results From Across the Web
More info about 'different functions with the same name' #33
There are not different functions with the same name...there is only one function with a particular name so not sure why this warning...
Read more >In programming, what do you call functions with the same ...
If the functions have the same name but different signatures within the same class, it is overloading. If they have the same name...
Read more >Can I have more than one function with the same name?
One function can be given many names, but many functions cannot have the same name. If we happen to declare two functions of...
Read more >Can variables belonging to different functions have same name
Yes, variables belonging to different function can have same name because their scope is limited to the block in which they are defined....
Read more >How can different functions have the same name? [duplicate]
It's called "function overloading" (or "method overloading"), having multiple functions/methods with the same name that are distinguished by ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s a workaround for CRA-4 here: https://github.com/welldone-software/why-did-you-render/issues/154
@vzaidman I’ve already checked it with the non-Gatsby project. The useTranslation hook will not cause any re-render issue while initial. If I intentionally cause the BigListPureComponent to be re-rendered then I will get the same rerender warning message as above.
https://codesandbox.io/s/why-did-you-render-sandbox-forked-891xf?file=/src/index.js