i i use "react-video-thumbnail-image" the video thumbnail is generated on each render of the component. But it only should render one time and not again.
How can i do that?
CodePudding user response:
You have several options to control re-rendering.
For class components:
- shouldComponentUpdate (https://reactjs.org/docs/react-component.html#shouldcomponentupdate)
- React.PureComponent (https://reactjs.org/docs/react-api.html#reactpurecomponent)
For functional components:
- React.memo() (https://reactjs.org/docs/react-api.html#reactmemo)
CodePudding user response:
Here is the Problem, React.memo does not solve the problem. All the time i reorder the list, the VideoThumbnail-Element is rerendered.