From 5464c7c1b8d0342950e5ecd340e3000dfb8227e9 Mon Sep 17 00:00:00 2001 From: JuliusHerrmann Date: Wed, 19 Jan 2022 17:44:28 +0100 Subject: [PATCH] remove unused jsx --- src/VisNetwork.js | 64 ----------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/VisNetwork.js diff --git a/src/VisNetwork.js b/src/VisNetwork.js deleted file mode 100644 index 273b247..0000000 --- a/src/VisNetwork.js +++ /dev/null @@ -1,64 +0,0 @@ -import React, { useEffect, useRef } from "react"; -import { Network } from "vis-network"; - -class Graph extends React.Component{ - constructor(props){ - super(props); - this.state = { - nodes:[ - { id: 1, label: "Node 1" }, - { id: 2, label: "Node 2" }, - { id: 3, label: "Node 3" }, - { id: 4, label: "Node 4" }, - { id: 5, label: "Node 5" }, - ], - edges:[ - { from: 1, to: 3 }, - { from: 1, to: 2 }, - { from: 2, to: 4 }, - { from: 2, to: 5 }, - { from: 3, to: 3 }, - ] - } - } - componentDidMount(){ - this.id = setInterval(()=>this.tick(), 1000); - } - componentWillUnmount(){ - clearInterval(this.id); - } - tick(){ - if(this.state.nodes[0].label === "Node 1"){ - var copy = this.state; - copy.nodes[0].label = "TEUZET"; - this.setState(copy) - }else{ - var copy = this.state; - copy.nodes[0].label = "Node 1"; - this.setState(copy) - } - } - render(){ - console.log(this.state); - return () - } -} - -function VisNetwork(inp) { - const visJsRef = useRef(false); - var nodes = inp.inp.nodes; - var edges = inp.inp.edges; - useEffect(() => { - visJsRef.current.graph = new Network(visJsRef.current, { nodes, edges }, {}); - // Use `network` here to configure events, etc - }, [visJsRef, nodes, edges]); - - //redraw the graph - if(visJsRef.current.graph != null){ - console.log("red") - visJsRef.current.graph.redraw(); - } - return
; -}; - -export default Graph;