Hacker News new | past | comments | ask | show | jobs | submit login

Don't get me wrong, I think there's a lot of value in components. If you look at my company's logo, you will see that it is three building blocks. Our framework and platform are all about reusable code blocks. Having said that, though, I think this is taking it way too far. Most of these things are trivial one liners in JavaScript. Yes, it is true that you can have many places in the code hooking into the same event listener, but guess what, having many event listeners hooked into the same event dispatcher is rather as edficient. And what if later I want to press the letter K? Do I need a component for every letter? For that matter why don't you have a component for addition and subtraction and another component for pressing the ? I mean, look at node modules. They do more than handle a single key press. Socket.io for example has an overall theme, so does express, and so do other modules. What is the theme here? Make every line into a component so I can introduce setup and teardown code for it?



The point is with component you have a choice of how granular you want your components depending on the project, and there is very low cost to breaking things down and having a bunch of dependencies. Whereas the tendency almost everywhere else is to either use monoliths and toolbelts with a bunch of stuff you don't need, or on the other hand to "cut & paste the wheel" on the other.

There are some components that bundle several components together, e.g. component/dom or component/enumerable. And there are certainly more general components for key handlers. But if you need just one piece of it, you don't have to install the whole bundle. And if you use it just once or a few times or in limited contexts, you're right, you can inline it and skip the dependency altogether. But the point is you have a choice depending on your needs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: