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.
21 lines
421 B
21 lines
421 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; |