2 ms·
If you look at the sample project you can see that this is a way to create nested objects which describe the page you are rendering. [1] Those objects can cont
by new_stranger 5y ago
If you look at the sample project you can see that this is a way to create nested objects which describe the page you are rendering. [1]
Those objects can contain I/O logic (database calls or http requests) which are used to populate the "component". [2]
This is not a true replacement for Javascript SPA frontends like react or vue which offer much more than rendered HTML. It's more of an opinionated way to organize and populate your HTML templates for plain server-rendered pages.
I am not a huge fan of this format as I prefer regular template partials + inheritance. [3]
1: https://github.com/yuriizinets/kyoto-hn/blob/master/page.stories.go#L11-L15 https://github.com/yuriizinets/kyoto-hn/blob/master/page.sto...
2: https://github.com/yuriizinets/kyoto-hn/blob/master/component.story.go#L36 https://github.com/yuriizinets/kyoto-hn/blob/master/componen...
3: https://lets-go.alexedwards.net/sample/02.08-html-templating-and-inheritance.html https://lets-go.alexedwards.net/sample/02.08-html-templating...