Hi,
I am wondering why the console reports the error at line 36. Thanks for your help.
For further actions, you may consider blocking this person and/or reporting abuse
Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.
Kafeel Ahmad (kaf shekh) -
Dany Paredes -
ashish -
Abhay Singh Kathayat -
Top comments (6)
You need to bind your callback function (at line 30) or use arrow function
Thank you so much for pointing this out! But I am still not sure how to bind the createSession method and the parameter function that takes in session and error (or use arrow function for these two), since they are methods of the OpenTok class. This part of the code is provided by the OpenTok platform.
You need to bind exactly callback function but not the "createSession" method of "OpenTok" instance.
Maybe I didn’t fully understand the problem, but why can't you do that?
Thanks! This fixes the error. Still have another question: console.log(this.state.sessionID) at line 17 and 19 output an empty string (the initial value), and this is problematic because the value inside the doc() at line 20 cannot be empty. However, I later added console.log(this.state.sessionID) after line 36, which output a non-empty sessionID string, suggesting that the generateSession function did successfully modify this.state.sessionID. What makes the change in this.state.sessionID not passed to the handleSubmit function?
Dude! Do not mutate the state! Use
setState
(more info: reactjs.org/docs/state-and-lifecyc...).Thanks man!