Issue
I am trying to use this line of code but looks like its using typescript. My project is not. I need to make it work in ReactJS (newbie to JS and ReactJS). Just need to understand what this below means and how to make it reactjs compliant.
const VideoPreview = ({ stream }: { stream: MediaStream | null }) => {
Changing to this fixes it, but do NOT know what | null means?
const VideoPreview = ({ stream }) => {
Solution
{ stream: MediaStream | null }
this line basically means that stream can be a type of MediaStream or null so || means it is OR, you can read about it here
Answered By - Sowam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.