You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Someone asked on Stack Overflow about a simple detail in the setup documentation, and while trying to get it to work on my side, I figured that the documented example doesn't work out of the box.
To make it work, I needed to install a couple more dependencies then documented:
lodash
graphology-types
And I needed to update the code to the following:
exportconstLoadGraph=()=>{// first change to the exampleconstloadGraph=useLoadGraph();// also wrapped the graph instantiation side-effectuseEffect(()=>{constgraph=newGraph();graph.addNode("first",{// Missing required positionx: 1,y: 1,size: 15,label: "My first node",color: "#FA4F40"});// Calling the function that was missing from the exampleloadGraph(graph);},[loadGraph]);// Returning null to get a valid componentreturnnull;};
I'm not even sure it's the best way to use react-sigma as I've never used it before, though the hello world style example is definitely broken.
The text was updated successfully, but these errors were encountered:
It looks like the required coordinates are still missing and the wrong function is used to load the graph inside the effect.
useEffect(()=>{constgraph=newGraph();// Missing the x and y optionsgraph.addNode("first",{size: 15,label: "My first node",color: "#FA4F40"});// This should be "loadGraph", since useLoadGraph is the hook and it is an invalid usage to have it hereuseLoadGraph(graph);},[loadGraph]);
Uh oh!
There was an error while loading. Please reload this page.
Someone asked on Stack Overflow about a simple detail in the setup documentation, and while trying to get it to work on my side, I figured that the documented example doesn't work out of the box.
To make it work, I needed to install a couple more dependencies then documented:
And I needed to update the code to the following:
I'm not even sure it's the best way to use react-sigma as I've never used it before, though the hello world style example is definitely broken.
The text was updated successfully, but these errors were encountered: