MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / Recursive

Function Recursive

examples/sandbox/src/Recursive.tsx:85–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83const RecursiveContext = createContext<(nodeId: number, parentsPath: number[]) => void>(() => {})
84
85const Recursive: Component = props => {
86 const [data, setData] = createStore<NodeType[]>([
87 {
88 id: 0,
89 children: [
90 {id: 1, children: [{id: 2, children: []}]},
91 {id: 3, children: []},
92 ],
93 },
94 ])
95
96 const addNode = (nodeId: number, parentsPath: number[]) => {
97 setData(
98 // @ts-ignore
99 ...genNodePath({nodeId, parentsPath}),
100 (children: any) => [...children, {id: ++id, children: []}],
101 )
102 }
103
104 return (
105 <RecursiveContext.Provider value={addNode}>
106 <For each={data}>{page => <Node {...page} />}</For>
107 </RecursiveContext.Provider>
108 )
109}
110
111export default Recursive

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…