title: Implement shouldComponentUpdate with React hooks - Render child only once, but make DOM changes when props change
body: <p>I have something working with a React.Component using shouldComponentUpdate, and want to convert it to use React Hooks, but I'm not sure it's even possible.</p>
  
  <p>I have a child component that renders a very expensive ChartingLibrary canvas, so I only want to render the Child react component once.</p>
  
  <p>The charting canvas content is dependent on props passed to the Child and certain apis on the ChartingLibrary have to be called with the props passed to the child. </p>
  
  <p>So when the props passed to the child changes, I need to call apis on the Charting Library, but I don't want to refresh the Child component.</p>
  
  <p><strong>This is working with a React Class as follows:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>
      const Parent = () =&gt; {
          &lt;Child/&gt;
      }
  
      export class Child extends React.Component {
          shouldComponentUpdate (nextProps, nextState) {
              ChartingLibrary.init()
              ChartingLibrary.doStuffWithProps(nextProps.data)
              return false
          }
      }
  
  </code></pre>
  
  <p><strong>React.memo is problematic:</strong></p>
  
  <p>The closest I can get to the React.Component version is with React.Memo, but I don't have access to the ChartingLibrary from inside the isSame function. React. The React.Component version gives me access to ChartingLibrary from inside the component whereas React.memo can only be done from outside the component.</p>
  
  <pre class="lang-js prettyprint-override"><code>
      const Parent = () =&gt; {
          &lt;Child/&gt;
      }
  
      const Child = (props) =&gt; {
          ChartingLibrary.init()
          ChartingLibrary.doStuffWithProps(props) 
      }
      const ChildMemo = React.memo(Child, function isSame (prevProps, props) {
          ChartingLibrary.doStuffWithProps(props)
          return true
      })
  </code></pre>
  
  <p>Is there a better way? Is what I'm trying to do possible with hooks?</p>