Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroring out while rendering #77

Open
BalakrishnanKumaravel opened this issue Nov 12, 2019 · 1 comment
Open

Erroring out while rendering #77

BalakrishnanKumaravel opened this issue Nov 12, 2019 · 1 comment

Comments

@BalakrishnanKumaravel
Copy link

Hi,

Getting the below error.

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

Basically I am having a file called networkgraph.tsx and having this code inside it and calling this method to render the graph. When this method gets executed, I am getting the above error. Am I missing something?

import * as React from "react";
const Graph = require("react-graph-vis");

export default function NetworkGraph(): JSX.Element {
const graph = {
nodes: [
{ id: 1, label: "Node 1", title: "node 1 tootip text" },
{ id: 2, label: "Node 2", title: "node 2 tootip text" },
{ id: 3, label: "Node 3", title: "node 3 tootip text" },
{ id: 4, label: "Node 4", title: "node 4 tootip text" },
{ id: 5, label: "Node 5", title: "node 5 tootip text" }
],
edges: [
{ from: 1, to: 2 },
{ from: 1, to: 3 },
{ from: 2, to: 4 },
{ from: 2, to: 5 }
]
};

const options = {
layout: {
hierarchical: true
},
edges: {
color: "#000000"
}
};

const events = {
select(event: any): void {
const { nodes, edges } = event;
console.log("Selected nodes:");
console.log(nodes);
console.log("Selected edges:");
console.log(edges);
}
};

return (
<Graph
graph={graph}
options={options}
events={events}
style={{ height: "640px" }}
/>
);
}

Thanks,
Bala.

@BalakrishnanKumaravel
Copy link
Author

Is there any specific version on packages I need to use to make this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant