Answer the question
In order to leave comments, you need to log in
React Hooks, Twilio-video, how to set dominantSpeaker screen only 2 seconds after state changes?
const Room = ({....
....
const [dominantSpeaker, setDominantSpeaker] = useState(null);
.....
useEffect(() => {
if (dominantSpeaker) {
console.log('dommm', dominantSpeaker);
setParticipants(prevParticipants => [
dominantSpeaker,
...prevParticipants.filter(participant => participant !== dominantSpeaker),
]);
}
}, [dominantSpeaker]);
now screen changes as soon as state changes
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question