File size: 585 Bytes
7aa3f89 b8cc9bf 7aa3f89 58c1cf6 7aa3f89 5e85715 7aa3f89 5e85715 a193114 7aa3f89 a193114 58c1cf6 a193114 7aa3f89 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import React, { useEffect, useState } from 'react';
import ReactFlow from 'reactflow';
import 'reactflow/dist/style.css';
import './styles.css';
const App = () => {
const [elements, setElements] = useState([]);
useEffect(() => {
fetch('http://localhost:5000/api/data')
.then(response => response.json())
.then(data => {
setElements(data.nodes.concat(data.edges));
})
.catch(error => console.error('Error:', error));
}, []);
return (
<div className="app">
<ReactFlow elements={elements} />
</div>
);
};
export default App; |