I have two sibling components WebcamStream and CaptureArea, I want to pass reference to WebcamStream as prop of CaptureArea, but when I do this, it always null. How to fix this ?
class AppContent extends React.Component {
constructor(props) {
super(props);
this.videoTag = React.createRef();
}
render() {
return (
<div id="content">
<WebcamStream ref={this.videoTag}
width="300" height="300"
title="Real-time video stream from webcam"
id="video" />
<CaptureArea x="20" y="20" width="120"
height="120" color="white"
videoTag={this.videoTag.current}/>
</div>
);
}
}
Why I need this: CaptureArea generates temporary canvas on current video tag to get imageData from it. I use imageData to parse QR Code.