This may be a simple question but in our UI app we have a pattern my team has used to wrap an object of translation strings from i18next into a state which is never updated. The idea is, the translation function is used to generate the translations once and set into a state that is never updated, thus, when page re-renders for other reasons, it never re-calls the functions.
const [translations] = useState({
header: translate('translation.string.goes.here')
welcomeMessage: translate('translation.string.goes.here')
});
so then we can do something like translations.header and if page re-renders, the translate method isnt called anymore and basically, in a sense, caching the translations.
Is our assumption correct that translate will not be called again on re-renders?