You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
381 B
18 lines
381 B
import React, { useRef, useState, useEffect } from 'react';
|
|
import D3Chart from './D3Chart';
|
|
|
|
const ChartWrapper = () => {
|
|
const chartArea = useRef(null);
|
|
const [chart, setChart] = useState(null);
|
|
|
|
useEffect(() => {
|
|
if (!chart) {
|
|
setChart(new D3Chart(chartArea.current));
|
|
}
|
|
}, [chart]);
|
|
|
|
return <div ref={chartArea}></div>;
|
|
};
|
|
|
|
export default ChartWrapper;
|