question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can you provide examples of how to use methods in React?

See original GitHub issue

Hi @crubier, do you know is there any way to use the methods in vis documentation in react?(http://visjs.org/docs/network/#options)

I added these methods (getSelectedNodes for example) like this, but seems not working. Can you provide an example where to put this code snippet in readme of this please?

        var methods = {
            getSelectedNodes: function(node) {
                console.log('selected', node);
            },
        }

Thank you in advance.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
lrecknagelcommented, Mar 11, 2017

I think one way is to pass back the network instance from the Graph component via a callback. I´ve also needed it and implemented it here: https://github.com/lrecknagel/react-graph-vis

3reactions
kdog1425commented, Oct 16, 2017

@typekev - what @lrecknagel suggested worked for me. Please see working example: GraphView.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing Functions to Components - React
Is it OK to use arrow functions in render methods? ... Generally speaking, yes, it is OK, and it is often the easiest...
Read more >
Why and how to bind methods in your React component ...
React v0.13 introduced a major change in how you can define your component ... It can be done by using two methods that...
Read more >
React lifecycle methods: An approachable tutorial with examples
You would use the componentDidMount lifecycle method to grab a DOM node from the component tree immediately after it's mounted. For example, ...
Read more >
How to access component methods from “outside” in ReactJS?
React provides an interface for what you are trying to do via the ref attribute. Assign a component a ref , and its...
Read more >
pelotom/use-methods: A simpler way to useReducers - GitHub
Instead of providing a single "reducer" function which is one giant switch statement over an action type, you provide a set of "methods"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found