DEV Community

Discussion on: Rails to Introduce View Components

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

Who the heck nests render 10 levels deep?!

For a test page with nested renders 10 levels deep

I'm very wary of additional abstractions. Have it as a gem.

Collapse
 
jleblanc profile image
Josh LeBlanc

In composition? All the time.

If everything is decorating each other, you can get many levels very quickly. Take a list for example.

List

  • ListItem
    • ListItemAvatar
      • Avatar
    • ListItemText
      • ListItemPrimaryText

You're at 4 levels deep just from a list. That component would live in some other component, which would probably live in some other component, up until you reach the actual top level component. You could easily reach 10 levels.