Re-rendering a React component is just bad when it holds a video element

React doc suggests completely re-rendering a React component with new props if those props have been changed due to external events.

IMHO this makes no sense. If the React component holds a video element (whose src attribute has not changed) re-rendering it means that the video is destroyed and created again.

So, which is the proper way to deal with this scenario?

UPDATE: Forget my question, it's wrong. The video element is not destroyed and created every time props change.

Upvotes: 1

Views: 996

Answers (1)

Bhargav
Bhargav

Reputation: 918

For this exact reason there is the component lifetime method shouldComponentUpdate.

Upvotes: 4

Related Questions