chore(examples): second input for useNodesData
This commit is contained in:
@@ -14,8 +14,16 @@ function TextNode({ id, data }: NodeProps) {
|
||||
return (
|
||||
<div style={{ background: '#eee', color: '#222', padding: 10, fontSize: 12, borderRadius: 10 }}>
|
||||
<div>node {id}</div>
|
||||
<div>
|
||||
<input onChange={(evt) => updateText(evt.target.value)} value={text} />
|
||||
<div style={{ marginTop: 5 }}>
|
||||
<label style={{ fontSize: 12 }}>useState + updateNodeData</label>
|
||||
<input onChange={(evt) => updateText(evt.target.value)} value={text} style={{ display: 'block' }} />
|
||||
|
||||
<label style={{ fontSize: 12 }}>updateNodeData</label>
|
||||
<input
|
||||
onChange={(evt) => updateNodeData(id, { text: evt.target.value })}
|
||||
value={data.text}
|
||||
style={{ display: 'block' }}
|
||||
/>
|
||||
</div>
|
||||
<Handle type="source" position={Position.Right} />
|
||||
</div>
|
||||
|
||||
@@ -3,16 +3,7 @@ import { getElementsToRemove, getOverlappingArea, isRectObject, nodeToRect, type
|
||||
|
||||
import useViewportHelper from './useViewportHelper';
|
||||
import { useStoreApi } from './useStore';
|
||||
import type {
|
||||
ReactFlowInstance,
|
||||
Instance,
|
||||
NodeAddChange,
|
||||
EdgeAddChange,
|
||||
Node,
|
||||
Edge,
|
||||
NodeChange,
|
||||
EdgeChange,
|
||||
} from '../types';
|
||||
import type { ReactFlowInstance, Instance, Node, Edge } from '../types';
|
||||
import { getElementsDiffChanges, isNode } from '../utils';
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user