Considering the following code:
import React from 'react';
import {strings as frstrings} from '../res/lang/fr/strings'
import {strings as engstrings} from '../res/lang/eng/strings'
class CurentLang {
constructor(current){
this.current = current;
}
get current(){
return this.current;
}
switchLang() {
if(this.current === frstrings){
this.current = engstrings;
} else{
this.current = frstrings;
}
}
}
var currentStrings = CurentLang(engstrings)
export default currentStrings;
I want the currentStrings object be the same across all other js files that will use it. However i am not exactly sure how since i can export one instance that will always contain engstrings but will not change universally if one js page decides to switch it up.