April 2020
Intermediate to advanced
716 pages
18h 55m
English
In the PlayMedia component, we will check for data passed from the server and set the values to the state so the media details are rendered in the view when the server is generating the corresponding markup. We will do this checking and assignment as shown in the following code:
mern-mediastream/client/media/PlayMedia.js
if (props.data && props.data[0] != null) { media = props.data[0] relatedMedia = []}
If media data is received in the props from the server, we assign it to the media value in the state. We also set the relatedMedia value to an empty array, as we do not intend to render the related media list in the server-generated version. This implementation will produce server-generated markup with ...
Read now
Unlock full access