Rendering received data in PlayMedia

In the PlayMedia component, we will check for data passed from the server and set the values to state so the media details are rendered in the view.

mern-mediastream/client/media/PlayMedia.js:

...render() {    if (this.props.data && this.props.data[0] != null) {      this.state.media = this.props.data[0]       this.state.relatedMedia = []     }...}

This will produce server-generated markup with media data injected in the PlayMedia view.

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.