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 343B

12345678910111213141516
  1. import { useEffect } from 'react'
  2. import state from 'state'
  3. export default function useLoadOnMount() {
  4. useEffect(() => {
  5. const fonts = (document as any).fonts
  6. fonts
  7. .load('12px Verveine Regular', 'Fonts are loaded!')
  8. .then(() => state.send('MOUNTED'))
  9. return () => {
  10. state.send('UNMOUNTED')
  11. }
  12. }, [])
  13. }