I think I've figured it out.
I moved the large arrays to the state of the parent component and I'll just pass them as props to the visualization component. Then I just compute the values in componentDidMount
and componentWillReceiveProps
and save them into the state of the visualization component.
This avoids most of the useless computing in my case. But if it is not enough I can go further and diff the current props with the next props in componentWillReceiveProps
to determine if the computation is actually needed.
UPDATE: Now that I've worked more with React I think this should be done using memoizing. Reselect is good lib for that.