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
}

mobx-react-lite

Lightweight React bindings for MobX based on React 16.8+ and Hooks

MIT
Latest version published 7 months ago

Package Health Score

96 / 100
Full package analysis