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

custom add node button #57

Closed
slackermorris opened this issue Mar 18, 2018 · 1 comment
Closed

custom add node button #57

slackermorris opened this issue Mar 18, 2018 · 1 comment
Labels

Comments

@slackermorris
Copy link

@slackermorris slackermorris commented Mar 18, 2018

Hi Daniel, I presume that this is an annoying and amateur question to ask (of which I am both, unfortunately), but I am trying to use your library and want to add a custom button for adding nodes. However, when I try to change the data (using setState nodes and links) that a Graph is receiving as props, I get an error:

image

This is the code I am trying:

image

Please delete if this is unrelated or you think not worth time. Thanks for your help.

@danielcaldas

This comment has been minimized.

Copy link
Owner

@danielcaldas danielcaldas commented Mar 18, 2018

Hi there @slackermorris no such thing as an amateur question. In this case, I think you could look closer to your code and pay attention to details. Notice that in newData = { newNodes, newLinks }; you are breaking the data contract with react-d3-graph. All should be fine if you keep the properties naming correctly along the way.

// ...
let newData = { nodes: newNodes, links: newLinks };
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.