pqina / flip

⏳ The online version of the classic flip clock
https://pqina.nl/flip/
MIT License
874 stars 89 forks source link

Import error in next js #55

Open islamMaruf opened 1 year ago

islamMaruf commented 1 year ago

flip flip2

nelwincatalogo commented 1 year ago

Try it like this

useEffect(() => {
    let Tick = null;
    (async () => {
      Tick = (await import('@pqina/flip')).default;
      tickInstance = Tick.DOM.create(tickRef.current, {
        value: value,
      });
    })();

    return () => {
      if (tickInstance) {
        Tick.DOM.destroy(tickRef.current);
      }
    };
  }, [value]);