DEV Community

Discussion on: Add Jitsi Meet to your React App

Collapse
 
ericwooley profile image
Eric Wooley

Great, thanks for the post!

Let me know in the comments if you have a more elegant way of promise-ifying the script loading part! 😄

here is a suggestion for simplifying your promise a bit

const VideoConference = () => {
  // const jitsiContainerId = ...

  const loadJitsiScript = () => 
     new Promise((resolve) => {
      const script = document.createElement("script");
      script.src = "https://meet.jit.si/external_api.js";
      script.async = true;
      script.onload = resolve
      document.body.appendChild(script);
    });

  // return ( ... )
};
Enter fullscreen mode Exit fullscreen mode

Some comments have been hidden by the post's author - find out more