Created
October 2, 2020 10:12
-
-
Save sverhoeven/248014c06cacaf2f65f5885eb3e266fe to your computer and use it in GitHub Desktop.
run-cpp-on-web: kitchen-sink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function IterationsPlot({ iterations }) { | |
const container = React.useRef(null); | |
function didUpdate() { | |
if (container.current === null || iterations.length === 0) { | |
return; | |
} | |
const spec = iterations2spec(iterations); | |
vegaEmbed(container.current, spec); | |
} | |
const dependencies = [container, iterations]; | |
React.useEffect(didUpdate, dependencies); | |
return <div ref={container} />; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment