diff --git a/docs/index/src/examples/local-complex-tree-structure.tsx b/docs/index/src/examples/local-complex-tree-structure.tsx index f492a1df..7b666ded 100644 --- a/docs/index/src/examples/local-complex-tree-structure.tsx +++ b/docs/index/src/examples/local-complex-tree-structure.tsx @@ -40,14 +40,23 @@ function NodeListEditor(props: { nodes: State }) { // scoped state is optional for performance // could have used props.nodes everywhere instead const state = useHookstate(props.nodes); + + const handleAddNode = () => { + if (state.ornull) { + state.merge([{ name: `Untitled ${state.ornull.value.length + 1}` }]) + } else { + state.set([{ name: 'Untitled 1' }]) + } + } + return
{state.ornull && state.ornull.map((nodeState: State, i) => -
+
)} -