react-vis-network | Declarative vis.js network for react | Data Visualization library
kandi X-RAY | react-vis-network Summary
kandi X-RAY | react-vis-network Summary
react-vis-network uses a declarative approach to defining vis.js networks. This allows developers to work in React using normal stateful approaches like Redux and have the underlying network chart manage it's own lifecycle.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Load all theories in the story .
react-vis-network Key Features
react-vis-network Examples and Code Snippets
Community Discussions
Trending Discussions on react-vis-network
QUESTION
I'm trying to seperate a component like mentioned in the title.
According to the redux tutorial for react it's a best practice to split components up.
Until now I have the following components:
ReduxTestNetwork ...ANSWER
Answered 2018-Dec-01 at 00:00Several things:
- You don't need to use connect twice. Pass mapStateToProps and mapDispatchToProps at the same time, both on the container.
- If you want to follow the path of purely presentational components, consider using a side effect library: refract, sagas, thunk... they have patterns to deal with your logic outside of the component.
- If you prefer a more hand made approach, you could move every method you need to the container and pass to the component via props only the data and the function references to modify it.
QUESTION
I'm working at a project in which I have to display graphs. For displaying graphs I'm using vis.js in particular react-vis-network a implementation for using parts of vis.js in React with its stateful approaches.
Initial nodes and edges are loaded before my component is mounted and are passed as props for an initial state.
I attached two eventHandler one direct to a vis.js (the underlying DOM library) and the other at a decorator (button).
The desired/expected behaviour: A node is removed by clicking either the node or the corresponding button.
Observed behavior: Sometimes a node is removed and sometimes a node just disappears for a few ms and is reattached but without a decorator/button.
I already tried to start with an empty state and attaching the nodes,edges in componentDidMount() but I got the same result. I hope you can give me a hint. BTW: Is the way I use to attach components a/the right way? Every other help to improve my class is appreciated also
...ANSWER
Answered 2018-Oct-29 at 23:09It sounds like React is re-initializing your component when you are clicking a button. Maybe someone smarter than I am can figure out why that is happening...
But since no one has commented on this yet, one way I have handled these sorts of issues is to take the state management out of the display component. You say you are passing the nodes and edges via props from a parent component. You might consider moving the addNode
, removeNode
, createEdge
, and other methods up to the parent component so that it is maintaining the state of the node/edge structure and your display component is only displaying what it receives as props.
Perhaps this isn't an option in your app, but I generally use Redux to remove the state management from the components all together. I find it reduces situations like this where "who should own the state" isn't always clear.
QUESTION
I'm working on a project in which I have to display graphs. So I decided to use vis.js for this purpose. react-vis-network is a custom component for react to use vis.js. Now I'm struggeling to attach event handlers like I would normally do. You can find a hint at this section but I don't know how to manage properly.
In my manual attempt to use vis.js with react I would attach event handler like this:
...ANSWER
Answered 2018-Oct-28 at 21:38The event pattern is looking for a prop starting with 'on'
followed by a capital letter A-Z. Format your prop like the component expects:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-vis-network
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page