Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

events prop integration #17

Open
jariverswyvel opened this issue Dec 13, 2018 · 2 comments
Open

events prop integration #17

jariverswyvel opened this issue Dec 13, 2018 · 2 comments

Comments

@jariverswyvel
Copy link

add an object with events to handle clicks, hovers, hovers on edges, ...

const events = {
  select: ({nodes, edges}) => {
      console.log('nodes :', nodes);
      console.log('edges :', edges);
   },
  hoverEdge: ({edge}) => {
    console.log('edge :', edge);
  }
};

...

<Network options={options} events={events} style={{ height: '30rem', width: '100%' }}> 
  {nodes.map(node => (
    <Node id={node.id} key={node.id} image={node.image} decorator={this.decorator} mass={node.mass} label={node.label} />
   ))}
  {edges.map(edge => (
    <Edge label={edge.label ? edge.label : null} id={edge.id}  key={edge.id} from={edge.from} to={edge.to} />
     ))}
</Network>
@varqasim
Copy link

That would be great for my use case as well. Was hoping it was implemented :(

@conor909
Copy link

I agree, it would be better then accessing through refs.

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

No branches or pull requests

3 participants