worldcoin / idkit-js

Javascript toolkit to interact with the World ID protocol. Building the Identity SDK.
https://docs.worldcoin.org
MIT License
280 stars 71 forks source link

Error occurred while using emulator #170

Closed btboy12 closed 6 months ago

btboy12 commented 10 months ago

lib version

{
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "@worldcoin/idkit": "0.5.1",
}

I used vanilla js to integrate IDKit, as shown below

export const open = async ({ onSuccess }: WorldCoinArgs) => {
  const [{ createRoot }, React, { IDKitWidget, useIDKit }] = await Promise.all([
    import('react-dom/client'),
    import('react'),
    import('@worldcoin/idkit'),
  ]);
  const { useEffect } = React;

  const worldCoinEl = document.createElement('div');
  document.body.append(worldCoinEl);

  const root = createRoot(worldCoinEl);
  root.render(
    React.createElement(() => {
      const { setOpen } = useIDKit();
      useEffect(() => {
        setOpen(true);
      }, []);

      return React.createElement(IDKitWidget, {
        app_id: APP_ID,
        action: ACTION,
        onSuccess,
      });
    })
  );
};

But when I used the simulator to scan the QR code, it reported the following error

error
Bazzeman commented 10 months ago

❤️

Yokymia32 commented 9 months ago

🖤