neo4jd3
neo4jd3 copied to clipboard
Usage with React App
Is there a way to use neo4jd3 with React app ?
I got this working in my react app in the following way:
General:
-
npm i neo4jd3
- add a reference to d3 from a cdn in your index page
In the component:
import React from 'react'
import Neo4JD3 from 'neo4jd3'
class Graph extends React.Component {
componentDidMount() {
this.props.getGraph() // this sets a state property in my app with the neo4j data
}
componentDidUpdate(prevProps, prevState) {
const { data } = this.props; // the data retreived from getGraph() is passed to the component through props
if(data) {
new Neo4JD3('#graph', {
neo4jData: data,
minCollision: 75,
nodeRadius: 20
})
}
}
render() {
return <GraphGrid>
<TableTitle>Graph visualisation</TableTitle>
<Panel>
<GraphContainer id="graph"></GraphContainer>
</Panel>
</GraphGrid>
}
}
export default Graph
not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined
not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined
how to fix this
not working.. getting lots of error. GraphGrid, TableTitle, Panel, GraphContainer not defined
how to fix this
It was an example. You can remove those Components and create your own