vasturiano / react-force-graph

React component for 2D, 3D, VR and AR force directed graphs
https://vasturiano.github.io/react-force-graph/example/large-graph/
MIT License
2.21k stars 284 forks source link

React Router Link on Node Click #400

Open danielbakas opened 1 year ago

danielbakas commented 1 year ago

Is your feature request related to a problem? Please describe. Hi!! We wanted to add a simple react-router Link to each node in the graph, but just couldn't figure it out.

Describe the solution you'd like

import {Link} from 'react-router'
<ForceGraph3D
    nodeLabel={node => `${node.prefix}:${node.fragment}`}
    nodeLink={<Link to={node.path}/>}
/>

Describe alternatives you've considered We tried passing the link as the value for the nodeLabel or the nodeCanvasObject but we know those have different prop types.

Additional context Having the ability to use React Routing in the graph would be dynamite 💥

danielbakas commented 1 year ago

Hi @vasturiano! Any updates on this issue? 🤓

vasturiano commented 1 year ago

It's outside of the scope of this module to have integration with any app routing system including direct links. That type of functionality should be performed using onNodeClick.