I am looking to develop an object with custom getters and a key representing language. Depending on the language key, different values should be returned by the getters. This is specifically for a customizable language selection feature. As an example, one of the getters looks like this:
get homePage() {
return lang === 'eng' ? "Home" : "Ui"
}
The object structure is as follows:
export const contents = {
lang: 'eng',
get homePage() {
return lang === 'eng' ? "Home" : "Ui"
}
}
Action:
export const setLang = lang => ({
type: SET_LANG,
lang
});
lang is stored within the redux store. I now need to update the object whenever it changes, and then use these updated objects in other components. However, I am unsure about how to access the redux store within the object. Any recommendations?