←back to thread

378 points rbanffy | 1 comments | | HN request time: 0.191s | source
Show context
giancarlostoro ◴[] No.46210692[source]
Template partials look good, which is one of the key reasons frameworks like React are as good and popular as they are, because you can reuse small segments of code.
replies(8): >>46211187 #>>46211247 #>>46211354 #>>46211402 #>>46211982 #>>46212701 #>>46212849 #>>46213424 #
chistev ◴[] No.46211402[source]
But you could already reuse templates in Django by including them. What am I missing?
replies(3): >>46211411 #>>46212274 #>>46214475 #
1. WD-42 ◴[] No.46212274[source]
Partialdef inline is the real win. Lets you define parts of a page without needing to place them in another file. Reduces the mental overhead of imagining how the inclusion will look because it’s already there.

The use case is mainly driven by htmx where you will have lots of these partials and the view code renders them as individual responses.