lukejacksonn / ijk

Transforms arrays into virtual dom trees; a terse alternative to JSX and h
MIT License
467 stars 17 forks source link

Tags as functions #7

Closed yonatanmn closed 6 years ago

yonatanmn commented 6 years ago

Looks cool Here's an idea: Instead of strings for tag names use a set of functions so proper typing will provide auto complete and error throwing

Import { dom } from 'ijk'

const tree = h('name', 'props', 'children')(
  ['main', [
    [dom.h1( 'Hello World')]

    [dom.button({ onclick: console.log }, 'Log event ']
)
lukejacksonn commented 6 years ago

This is similar to what already exists already in a package like https://github.com/hyperapp/html which I really like and would recommend. But the idea behind this syntax is that you don't have to depend on (have to import) all the individual functions. This proposal defeats that point.

lukejacksonn commented 6 years ago

Closing here, let me know if you have any other thoughts! 🙇