You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

useLoadOnMount.ts 414B

1234567891011121314151617
  1. /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
  2. import { useEffect } from 'react'
  3. import state from 'state'
  4. export default function useLoadOnMount() {
  5. useEffect(() => {
  6. const fonts = (document as any).fonts
  7. fonts
  8. .load('12px Verveine Regular', 'Fonts are loaded!')
  9. .then(() => state.send('MOUNTED'))
  10. return () => {
  11. state.send('UNMOUNTED')
  12. }
  13. }, [])
  14. }