Remix.run Logo
lbreakjai 4 days ago

So now you have presentation logic, tightly coupled, spread over two places. You need to jump between two codebases to even have a clue about what is rendering on the page.

There's an example on their website where the header of a table is defined in the frontend, and the body is returned by the backend. If I wanted something as simple as switching the order of the columns, I'd actually need to create a new version of my backend endpoint, release it, change the frontend to use the new endpoint, then delete the old one. That sounds crazy to me.

turtlebits 3 days ago | parent | next [-]

So what if you have presentation logic in two places, if it isn't necessary, remove the second instance?

There are so many gains by not using a frontend. You've greatly reduced your site size, removed duplicated logic, a shitload of JS dependencies, and an unnecessary build step.

adamzwasserman 3 days ago | parent | prev [-]

I use nested templates the same way React uses nested components. The key is cascading the context (like props) down the hierarchy. Column order change? One edit in the table template; everything that includes it gets the update.

The "header frontend / body backend" split is a choice, not a requirement. I wouldn't make that choice.

lbreakjai 3 days ago | parent [-]

> The "header frontend / body backend" split is a choice, not a requirement. I wouldn't make that choice.

I mention it because that's the first example on the official website, so I'd assume this is the right way.

yawaramin 16 hours ago | parent [-]

Htmx is not a framework. It doesn't dictate a 'right way' to do anything. If you are interested in idioms that work well in practice, refer to the book that the htmx people wrote: https://hypermedia.systems/