DEV Community

Discussion on: Introducing the Marko Tags API Preview

Collapse
joshuaamaju profile image
Joshua

so many questions:

  • can effects be placed in loops.
  • will the value of collapsed be reset in the example with the collapsed variable every time the loop executes.

I used to say, "it's safe using a niche framework like Marko, it's basically html with some simple extra stuff", but I guess that's no more. And finally, passing functions to components, been waiting for that.

Collapse
ryansolid profile image
Ryan Carniato Author
  1. Yes. They can be nested. You more or less can develop a child component inline with its own state. We want you to not worry as much about components but think about what makes sense for you templating out your site/application.
  2. No. I find it more helpful to think of this in the declarative model like the DOM itself rather than the imperative VDOM model. But if you think of it in terms of For loop re-running nested state does not get reset. If you think of it in the declarative sense it only runs once when each loop iteration is created and then it just keeps in sync automatically.

It is still just HTML as it ever was. Our perspective hasn't change. This article is heavy on new syntax to show it off, but in general you are writing 80% HTML, dabble in a few components, and now instead of classes you have tags. You start from the same place of just writing HTML and then adding a couple tags here and there where you need some extra behavior. We haven't taken anything away, and through co-location we hope that the change is even less jarring than before. If you have a template you wish to manage as a single piece you don't have to split it apart for performance. This should simplify things. It also reduces the need for things like component.js files etc...

Every template language adds something to make it more than just HTML. Whether you use a tag or a class, or once you had custom event handlers in any framework they have gone beyond HTML. But it's still HTML at the foundation and that is what you will be doing most of the time anyway.

Collapse
joshuaamaju profile image
Joshua

Thanks, this would take some time getting used to. But it solves some problems I've had with the mental model of Marko, I guess that's just a product of too much React.