Skip to main content

Recursive state

The following example demonstrates how Hookstate can be efficiently used to manage tree-like data structure. It combines nested state with scoped state technique for scalable rendering.

Current state: [{"name":"Node 1","children":[{"name":"Node 1.1"},{"name":"Node 1.2"}]},{"name":"Node 2"}]
Last render at: 2025-05-07T19:21:35.827Z

Last render at: 2025-05-07T19:21:35.828Z

Last render at: 2025-05-07T19:21:35.829Z

Last render at: 2025-05-07T19:21:35.829Z

Last render at: 2025-05-07T19:21:35.829Z


Loading code sample from: https://raw.githubusercontent.com/avkonst/hookstate/master/docs/index/src/examples/local-complex-tree-structure.tsx