Cache a 3rd party API call in React
Clash Royale CLAN TAG #URR8PPP Cache a 3rd party API call in React I'm integrating a video component into my page that is inserted and removed from the DOM based off the state of its parent. Whenever the video component is mounted it uses a prop video-id to call the 3rd party API of the video hosting service I'm using, Brightcove , which gives back a blob src for the video and sets up the video player. My component looks something like this: video-id Brightcove src componentDidMount() { bc(this.videoRef.current); // brightcove initialization script const player = videojs(this.videoRef.current); } render() { return ( <video ref={this.videoRef} data-video-id={this.props.videoId} > </video> ); } An example of how brightcove videos are loaded is here: https://codepen.io/team/rcrooks1969/pen/JywoKE My problem is that each time this component gets unmounted and mounted again it has to call the API to setup the ...