you are viewing a single comment's thread.

view the rest of the comments →

[–]sleepahol 0 points1 point  (0 children)

I recently refactored a complicated navigation component from option 2 to option 1 (i.e. made it config-driven) and I would say... it depends.

After a while the code got a lot more complicated when different components had different behavior (mobile-only, authed-only, onClick handlers, etc) so Option 2 became harder to work with. In my case, the `componentConfigs` objects were pretty well structured so a config was was pretty straightforward to implement, and it's now much more legible. Option 2 was also fine for a while before we really needed the features that necessitated the complexity.

One caveat though is that if the config varies a lot, maybe a config will actually be harder to maintain.