Menu

Why I Stopped Putting So Much Logic in Templates
📰
0

Why I Stopped Putting So Much Logic in Templates

DEV Community·Jose Angel Navarro Martinez·about 1 month ago
#Ffl7B0wg
Reading 0:00
15s threshold

I don’t think templates should become hidden execution environments. That was one of the main ideas I kept coming back to while building Pick Components , a small Web Components framework I’ve been working on in TypeScript. I haven’t been doing TypeScript forever. In fact, part of the reason I started building this was because I wanted to understand the browser, components, templates, decorators, and reactivity from the inside instead of just using another big stack and accepting all of its decisions. At first, templates feel like the obvious place to add power. You start with: <p> Hello, {{name}} </p> Enter fullscreen mode Exit fullscreen mode Then you want conditions. Then loops. Then expressions. Then event wiring. Then helper calls. Then more complex logic. And after a while, the template is no longer just describing UI. It starts becoming a second programming environment. That is where things get uncomfortable for me. The problem is not templates I like templates. They are readable.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More