top | item 39783289

(no title)

mainframed | 1 year ago

But `a` is included. You don't have to build a `Link` component. If you want to stylize your links in consistently across your page, you can build your own Link.

The example does nothing other than renaming `href` to `to` and adding a style.

How should the framework know which styles you want to apply to a link?

I think the example explains the component-driven design of the library well.

discuss

order

TylerE|1 year ago

How would you feel if the first example in, say, a ruby tutorial, was how to redefine the ‘+’ operator to use a different symbol?

It’s somewhere between pointless and confusing to me, and isn’t illustrative of why one would want to use components, or what a competent even is.

MrJohz|1 year ago

Interestingly, the second example on the official Ruby "About" page is almost exactly that: it defines .plus to be an alias of .+, and demonstrates how it might be used.

https://www.ruby-lang.org/en/about/

As a web developer (and therefore, I imagine, part of the target demographic for this sort of tool), I personally find this component example very useful. Components are very powerful, but most existing Python templating languages make it difficult or overly verbose to use them to their full extent. This is a really good demonstration of how I can write simple presentational components and use them with server-rendered HTMX. That shows off one of the main things I would want to do with this sort of framework.

So from that perspective, this is very much the perfect sort of example.