How to use the mobx-react-lite.useDisposable function in mobx-react-lite

To help you get started, we’ve selected a few mobx-react-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jauhararifin / ugrade / ui / src / window.ts View on Github external
export function useServerClock() {
  const store = useWindow()
  const [serverClock, setServerClock] = useState(undefined as undefined | Date)
  useDisposable(() => reaction(() => store.serverClock, () => setServerClock(store.serverClock)))
  return serverClock
}