trueadm / t7

Lightweight virtual DOM templating library
901 stars 31 forks source link

Universal Mode #30

Open rbiggs opened 7 years ago

rbiggs commented 7 years ago

I find the library interesting. I love how you do this with template literals, especially the ability to create child components. I'm not a React, Mithril guy. I wondering about the Universal option. You only have examples for React. Could you put something together with the Universal to show how to use this for generic purposes? I'm interested in using it with Virtual-Dom or some similar solution.

davemackintosh commented 7 years ago

I'll look into doing this this week. I'm not a React guy either and had to work this out too.

rbiggs commented 7 years ago

Cool. I was thinking of using this with some virtual DOM implementation, but I'm not sure with the object it returns what it's purpose is. Possible match could be: virtual-dom, snabbdom, domvm, morphdom. Or maybe it possible to just use a standalone node creator function that can work with the return value from Universal mode? I know it was originally created to use with Inferno, but the Universal mode implies you should be able to have a solution to create nodes without the Mithril, React/Inferno/Preact tie in. I've used hyperx a lot, but I see this as a better implementation of the same thing. Yeah, so basically I'm interested in replacing hyperx with this.

davemackintosh commented 7 years ago

Yeah, I use it with the Virtual DOM library you linked to. I was just playing with the idea of it so I could better understand the virtual DOM concept. You can see my code here https://github.com/davemackintosh/melodist/blob/components-test/vendor/qualia/src/qualia.js

There are some fixes that need to be pushed into this repo for the universal output (which you can also see in that code) but at least, until I've updated the README.md and applied the fixes you have an example usage with the Virtual DOM library.

That also uses flow, you can see the compiled (type-less) code here https://github.com/davemackintosh/melodist/blob/components-test/vendor/qualia/dist/qualia.js

rbiggs commented 7 years ago

Thanks for the quick replay ;-). I'll need some strong coffee before I can grok what's going on there in Melodist. He he. I've done a lot of TypeScript but I've never even seen flow in use before. It doesn't look that different from TypeScript. Types are types, doh!