If you were given a task to implement state management solution, how would you do it?
Is this a good solution?
function GlobalState() {
let val;
const setVal = (value) => {
val = value;
};
const getVal = () => {
return val;
};
return { setVal, getVal };
}