
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-nodemap
Advanced tools
Made with create-react-library
react-nodemap(I prefer to call it react-mindmap, but it is massively used 😰) is a mindmap React component that I converted from Vue by hand,so you may expect some bugs in any stage from packaging to excution. Feel free to post any issue you find, I will try my best to take care of it.
the original Vue version: [https://github.com/hellowuxin/mindmap]
play with the Demo
npm install react-nodemap
or
yarn add react-nodemap
| Property | Description | Type | Default |
|---|---|---|---|
| defaultValue | tree data(currently only accepts one obj in the array as the only root ) | [] | [{ name: 'Root', children: [] }] |
| value | same as defaultValue, but has full control | [] | [{ name: 'Root', children: [] }] |
| depthLimit | add limit to tree depth | int | null |
| fields | specify the extra fields you pass into the data structure and also expecting them back when exported in onDataChange, by default see below node structure | [] | ['id','createdAt'] |
| onDataChange | function to update your data passed in value prop | func | |
| style | good to specify whole canvas width and height, especially for export to pdf, the best is a 297:210 ratio landscape | {} | none |
| exportWatermark | show you own watermark img when export, you need at least a imgSrc a imgUrl or relative path and format e.g. 'JPEG', 'PNG', 'WEBP'(for jsPDF) | {} | {} |
Node Data Structure Export
{
name:'',
children:[],
// generated in the tree constructor, will be replaced if you have your own fields array
size:[],
color:'',
depth: 0,
nodeId: 0,
}
onDataChange will only fire when you add, delete, move branch, change sibling positions and change text of nodes(when a node input loses focus)fields as an array like ['id','createdAt'] to keep data clean when exporting, but 👇! WARNING: avoid passing in fields with already taken names, see above node structure
you can play around with the component <Nodemap /> even before adding any props, but be sure to add onDataChange func to update the var you passed into the value prop
import React, { Component } from 'react'
import Nodemap from 'react-nodemap'
import 'react-nodemap/dist/index.css'
class Example extends Component {
constructor(props){
super(props)
this.state = {
data: [
{
name: 'some text',
children:[
{
name: 'some other text',
children:[]
}
]
}
]
}
}
onDataChange = (value) =>{
this.setState({
data: value
})
}
render() {
return
<Nodemap
defaultValue={this.state.data}
onDataChange={this.onDataChange}
depthLimit={4}
fields={['id','createdAt']}// output fields will be ['name', 'children','id','createdAt'], others will be omitted
/>
}
}
or
import React, {useState, useEffect} from 'react'
import Nodemap from 'react-nodemap'
import 'react-nodemap/dist/index.css'
const App = () => {
const [data,setData] = useState([
{
name: 'some text',
children:[
{
name: 'some other text',
children:[]
}
]
}
])
return (
<div>
<Nodemap
value={data}
onDataChange={(value) => setData(value)}
depthLimit={0}
fields={['color','depth','id']}
/>
</div>
)
}
MIT © ysqsimon
FAQs
Made with create-react-library
We found that react-nodemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.