Hi! My name is Yannis and I'm new to the group and have a question :)I have a d3 force running inside a useEffect in a ReactJS component. The d3 graph is triggered by a form submit outside the component and the graph is generated from the data passed in as props. When the form is resubmitted once the d3 graph was already generated once, it just adds more nodes/links/labels above the existing nodes/links/labels but I would like it to clear the SVG canvas each time there is a new search. Does anyone have any suggestions about how to approach this?
--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/d3-js/98dd05a3-1afc-4423-8b3f-efb4c0387888n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/d3-js/69a71b6e-ef07-471a-be26-a9abdf467309n%40googlegroups.com.
On May 20, 2021, at 4:46 PM, Yannis Panagis <yannis.pa...@gmail.com> wrote:
Hi! My name is Yannis and I'm new to the group and have a question :)I have a d3 force running inside a useEffect in a ReactJS component. The d3 graph is triggered by a form submit outside the component and the graph is generated from the data passed in as props. When the form is resubmitted once the d3 graph was already generated once, it just adds more nodes/links/labels above the existing nodes/links/labels but I would like it to clear the SVG canvas each time there is a new search. Does anyone have any suggestions about how to approach this?