When a Typescript globalThis.myvar changes, it doesn't cause React Typescript components to render

Viewed 17

I resorted to a global variable, putting it in global.d.ts, and to referring to it with globalThis.myvar. It is getting changed correctly when the onPress() happens to change it. However, the components are not rendering.

Is there a hook that will work with a globalThis.myvar style global to cause the render of interested components when the value changes? For example can I useEffect on a global?

0 Answers
Related