# Please init meeting first! Error when adding div id="zmmtg-root" inside a React component

**URL:** <https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598>\
**Category:** Web\
**Created:** [September 9, 2020, 7:59am UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598 "2020-09-09T07:59:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kannan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kannan/32/1768_2.png) [@kannan](https://devforum.zoom.us/u/kannan)\
**Post date:** [September 9, 2020, 7:59am UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/1 "2020-09-09T07:59:33Z")

</div>

**Description**  
Getting the error Please init meeting first when adding a div id=“zmmtg-root”# inside a component

**Error**  
{  
“method”: “init”,  
“status”: false,  
“errorCode”: 3008,  
“errorMessage”: “Please init meeting first!”,  
“result”: null  
}

**Which version?**  
1.8.0

**To Reproduce(If applicable)**

1. Use this repo for code - [https://github.com/shkhalid/zoom-web-sdk-react-example](https://github.com/shkhalid/zoom-web-sdk-react-example)
2. Inside App.js add div id=“zmmtg-root”
3. npm i && npm start to start the app

- OS:Mac os Catalina
- Version: 83
- Browser:Chrome

**Additional context**  
This repo works without adding the custom div inside. I am trying to embed the websdk into a component. That’s when I run into this error.

1. Token are generated
2. Meeting gets initialized Successfully
3. when the Join meeting is called I get this error

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![sgahaghan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sgahaghan/32/14990_2.png) [@sgahaghan](https://devforum.zoom.us/u/sgahaghan)\
**Post date:** [September 10, 2020, 4:38pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/2 "2020-09-10T16:38:40Z")

</div>

Angular has the same issue. If you add div id=“zmmtg-root” then the “Please init meeting first!” error occurs.

[Sample Project](https://websdk-sample-angular-issue.s3-us-west-2.amazonaws.com/websdk-sample-angular-issue.zip)

I have attached a sample project based on the standard angular sample that demonstrates the issue. The attached sample works in 1.7.9 but fails in 1.8.0

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [September 14, 2020, 8:11pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/3 "2020-09-14T20:11:09Z")

</div>

Hey @sgahaghan, @kannan,

Currently setting the div `id="zmmtg-root"` is not supported. The Web SDK appends it to the DOM itself.

What is your use case for adding the `zmmtg-root` id in a custom way?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kannan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kannan/32/1768_2.png) [@kannan](https://devforum.zoom.us/u/kannan)\
**Post date:** [September 16, 2020, 6:31am UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/4 "2020-09-16T06:31:09Z")

</div>

@tommy I would like to keep it inside the component, resize the view (which right now takes up the full page) and add some event handlers are something. I want to destroy WebClient when my component moves out of view.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [September 18, 2020, 6:49pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/5 "2020-09-18T18:49:05Z")

</div>

Hey @kannan,

Gotcha, you can see a similar approach in the Angular Sample App:

> <https://github.com/zoom/websdk-sample-angular/blob/master/src/styles.css#L7>

> <https://github.com/zoom/websdk-sample-angular/blob/master/src/app/app.component.ts#L53>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kannan](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kannan/32/1768_2.png) [@kannan](https://devforum.zoom.us/u/kannan)\
**Post date:** [September 18, 2020, 7:03pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/6 "2020-09-18T19:03:39Z")

</div>

@Tommy but if you see my error description I get that error while doing something similar to this

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [September 21, 2020, 10:08pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/7 "2020-09-21T22:08:53Z")

</div>

Hey @kannan,

Gotcha! I suggest adding the [preload / prepare scripts to the top of your app](https://github.com/shkhalid/zoom-web-sdk-react-example/blob/master/src/App.js#L42) so they load right away.

Here is an example:

> <https://github.com/zoom/websdk-sample-angular/blob/master/src/app/app.component.ts#L7>

Try that and let me know if it fixes the issue! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![mehdi.rouis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/mehdi.rouis/32/16685_2.png) [@mehdi.rouis](https://devforum.zoom.us/u/mehdi.rouis)\
**Post date:** [October 6, 2020, 3:10pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/8 "2020-10-06T15:10:34Z")

</div>

Hello,  
I had exactly the same problem.  
I found a solution with Javascript ( angular project )  
You have to create a div with id “zoom-content” into where you want and then into your javascript or component:  
const zoomMeetingDiv = document.getElementById(“zmmtg-root”);  
const zoomContent = this.document.getElementById(‘zoom-content’);  
zoomContent.appendChild(zoomMeetingDiv);  
When you appendChild an existing node, it will be moved without a creation.

Have a nice day.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 7, 2020, 10:16pm UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/9 "2020-10-07T22:16:38Z")

</div>

Thanks for sharing this @mehdi.rouis! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [November 7, 2020, 8:16am UTC](https://devforum.zoom.us/t/please-init-meeting-first-error-when-adding-div-id-zmmtg-root-inside-a-react-component/29598/10 "2020-11-07T08:16:40Z")

</div>

Closed on November 7, 2020, 8:16am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
