AgoraIO-Community / OpenAgoraWeb-React

Video Call App built with :heart:Agora SDK:heart: and React
MIT License
100 stars 43 forks source link

Calling `setState` in `addStream`. #11

Closed jcorkhill closed 4 years ago

jcorkhill commented 4 years ago

Hello.

On line 48, right here, you state that it's not recommended to call setState in the addStream function, but yet you go ahead and do that anyway on line 250, right here.

I'm wondering why that's not recommended and how it should be rectified.

Thanks.

plutoless commented 4 years ago

i checked the code blame and it was like committed 2 yrs ago. From my personal perspective there's nothing wrong to setstate within addStream function. Maybe it's for some old version sdk. You may checkout https://github.com/AgoraIO/Basic-Video-Broadcasting/tree/master/OpenLive-Web to see if this demo works for you as well.

plutoless commented 4 years ago

and https://webdemo.agora.io/agora-web-showcase/examples/OpenLive-Web/#/ for quick demo try out.

jcorkhill commented 4 years ago

Thanks @plutoless. I'll take a look. I ended up building my own version with Refs and Hooks.