Components are Pure Overhead

image

Almost. Your #2 is not what I wanted people to walk yonder with. Let me try to this again.

  1. Components are unnecessary overhead at runtime for non-VDOM libraries. We don’t want them.

  2. Components are an unnecessary restriction to write performant lawmaking for VDOM libraries. We need them.

In both cases performance has an implication on our decisions and affects how we write our code. Modularity is good, but why should we be limited by the framework to decide where those boundaries are?

As I said in the first sentence of the last section, I am not saying we don’t write our lawmaking as components or modular re-usable pieces. But rather with the language we have for transpiration (like hooks), we can rely on those to manage our updates rather than have a mental model virtually Components re-executing.

Once you decouple this you no longer need to worry well-nigh either performance issue I described in the article. So you are self-ruling to just write your components in whatever way makes sense to you or the scenario. This removes the friction virtually stuff forced into too many or too few components by the framework.

This is a DX unlock increasingly than a performance one, since if written properly both approaches are stupidly fast. But what if we didn’t have to worry well-nigh this at all? Ultimate performance without plane a mental consideration by the end-user.

Where I sit this would be an incredible improvement. But clearly, these ideas will need increasingly touchable examples than what I am worldly-wise to provide at the moment. Solid only covers it from a runtime perspective. Something like Svelte with some changes could work like this, which is what I’m pointing at towards the end, and I’d love to see that.

Author: Shantun Parmar

Leave a Reply

Your email address will not be published.