JSMediaSdk_Instance not defined on React App

Hello, im currently using the SDK for some project

But for some reason i got black screen with the [JSMediaSdk_Instance not defined] error everytime i joined a meeting, even though in the host side, the participant still counted as joined

I read the forums and some people say that u need to add these in didmount or useEffect:

ZoomMtg.setZoomJSLib("node_modules/@zoomus/websdk/dist/lib", "/av");
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();

I did that, but still got the errors.

here’s my full code:

import React, { useEffect, useCallback } from "react";
import "./App.css";
import { ZoomMtg } from "@zoomus/websdk";
import { generateSignature } from './Function/GenerateSignature';

function App() {
  const apiKey = process.env.REACT_APP_API_KEY;
  const secretKey = process.env.REACT_APP_API_SECRET;
  const signature = generateSignature(apiKey, secretKey, 74780324270, 0);

  useEffect(() => {
    ZoomMtg.setZoomJSLib("node_modules/@zoomus/websdk/dist/lib", "/av");
    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();
    initiate();
  }, []);

  const initiate = () => {
    ZoomMtg.init({
      leaveUrl: 'https://www.google.com',
      isSupportAV: true,
      success: (success) => {
        console.log(success)
    
        ZoomMtg.join({
          signature: signature,
          meetingNumber: 74780324270,
          userName: 'Hendry Varvar',
          apiKey: apiKey,
          passWord: '4rBFJm',
          success: (success) => {
            console.log(success)
          },
          error: (error) => {
            console.log(error)
          }
        })
    
      },
      error: (error) => {
        console.log(error)
      }
    })
  };

  return (
    <div className="App">
      
    </div>
  );
}

export default App;

Thanks in advance !

Hey @Rahjaesh,

Thank you for reaching out to the Zoom Developer Forum. Please try using the CDN Method to load dependencies. Here’s an example from our Sample React App that you can use as a reference.

Let me know if that helps.

Thanks,
Max