DEV Community

Discussion on: Tips to write elegant and resilient components

Collapse
 
drewtownchi profile image
Drew Town

Component names should be multi-worded to help avoid conflicts with current and future HTML elements. Your examples are but it isn't stated anywhere. Obviously, you wouldn't use <button> but you should also not use <modal> in case that makes it into the HTML spec some day.

I waffle a lot about whether or not to pass full objects as props. On the one hand it is very convenient on the other hand it is less explicit about what the child is expecting to use.

Collapse
 
christopherkade profile image
Christopher Kade

I wholeheartedly agree Drew.

I've had trouble understanding code bases where complex object structures are passed as props, I really think it's about losing less time on refactoring & having newcomers grasp a prop's role faster.