I have the following in my codebase right now:
export const myState = {
mylist: [],
}
export function flagSomething(default) {
myState.mylist.map((i) => {
i.setFlag(true)
i.setInitial(default)
})
}
export function unflagSomething(default) {
myState.mylist.map((i) => {
i.setFlag(false)
i.setInitial(default)
})
}
Basically just a file that has global functions to change the values of a global variable. How can I use React context to make this available "globally", but without actually polluting my global namespace? Thanks for any help!