Live data from Hacker News

Ijk – Transforms arrays into virtual DOM trees

github.com

11–20 of 49 posts

Re: Ijk – Transforms arrays into virtual DOM trees

#11

Interesting approach. I did something similar a while back, took a more function-based approach: https://github.com/undecided/tg At that point, I hadn't really done much react-style apps - will have to see how well that works with React!

I got it working with preact.. didn't try with react!

Re: Ijk – Transforms arrays into virtual DOM trees

#12
post #7

I like the syntax, but I have to say that I prefer JSX. The real advantage of JSX is that it's very similar to HTML and developers have been reading, mentally modeling and reasoning about HTML -> DOM translation for decades.

To be fair, you could say the same thing about Markdown. And yet here we are.

Re: Ijk – Transforms arrays into virtual DOM trees

#13

Improve it a little bit more by by removing the single quote by turning the html tags into functions that accepts 2 arrays: the attributes and the child elements, by this time you will come across with elm in which expressing the html document tree fits perfectly in the language syntax and semantics.

We already have something similar to this at hyperapp.. it is https://github.com/hyperapp/html. But yes, as mentioned by @masklinn, the drawback is you then have to define every element and then import all those definitions. With ijk you can write dependency free views (no import of h or h1, h2, etc.)

Re: Ijk – Transforms arrays into virtual DOM trees

#15

Reminiscent of Breve. https://github.com/cwells/breve I don't see a huge advantage over hyperscript (hyperapp and mithril both use it), but that is a ridiculously small codebase. The JS hate is kind of funny around here, because when you dig into stuff like this, you realize that JS is very lispy in ways (it's easy to build up trees of HTML dynamically). In the mid aughts on r/programming people would rant and rave a…

Haha! The main advantage I see in a syntax like this (as supposed to h by hyperapp for example) is.. not having to write `h` all the time, that and optional props.

I have been thinking of adding shorthand for id/classes in the tag name like hyperscript or JSnoX.

That would mean you could write `['input#search.large']`

Re: Ijk – Transforms arrays into virtual DOM trees

#18
post #7

I like the syntax, but I have to say that I prefer JSX. The real advantage of JSX is that it's very similar to HTML and developers have been reading, mentally modeling and reasoning about HTML -> DOM translation for decades.

To be fair, you could say the same thing about Markdown. And yet here we are.

What is the link between the two? Markdown does not really look or works "like" HTML, it just happens to compile to it.

Re: Ijk – Transforms arrays into virtual DOM trees

#19

Interesting approach. I did something similar a while back, took a more function-based approach: https://github.com/undecided/tg At that point, I hadn't really done much react-style apps - will have to see how well that works with React!

I got it working with preact.. didn't try with react!

[deleted]
Post reply on HN