Loss of ComponentWillReceiveProps with IFrames and 3rd Party Javascript

(Markdemich) #1

I have a React Component that wraps an IFrame. Because I don’t want react to rerender the IFrame on property changes, I return false from shouldComponentUpdate. I then used ComponentWilllReceiveProps to sense property changes and then do things manually in the javascript like sent postMessages to the IFrame. I use a similar technique to wrap some non-react third-party javascript objects. Basically, I have to stop react from messing with the DOM. This all works well. However, now with React 16, we are deprecating ComponentWillReceiveProps, and I have yet to find an equivalent solution.

I thought I could use getDerivedStateFromProps, but that’s static so I can’t get the instance pointer to my object so that doesn’t help.

Does anyone have any thoughts on that?