I am playing around with immer.js. Immer.js lock obejct after giving new instance. Is it ok to use this locked object as global state?
windows.initialState = {a: 'a'};
const nextState = produce(initialState , draftState => {
draftState.a = 'b',
});
windows.initialState = nextState;
Yes, you can assign and keep the frozen object to the global state. As long as your global object(initial state) is not declared as const. So, Nothing wrongs with this code.