Is there any way to have a component that renders itself recursively? E.g. a menu item with children, that can also render itself. (As long as the child’s item still has children.)
I wanted to do it today but saw an error “A component cannot render itself.” or something like that, while trying to accomplish that.
For now as a workaround I’ve created a few copies of a “MenuItem” component, e.g. Item1
Item2
Item3
, where Item1
renders Item2
s, Item3
renders Item3s
… But this forces me to build and maintain more components than needed.
Wondering if there’s any better way to accomplish that?