Skip to content

Sugar syntax for creating inferno virtual DOM elements

License

Notifications You must be signed in to change notification settings

rickmed/inferno-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

inferno-helpers

Sugar syntax for creating inferno virtual DOM elements

Inspired by this hyperscript-helpers

To use

let { div, p } = require('inferno-helpers')

let childNode = p('.class', 'Hello', { style: { marginLeft:200 } })

let parentNode = div(childNode, '.class1 #id .otherClass', 'Hello again!')

let template = createTemplate( () => parentNode )

import InfernoDOM from 'inferno-dom'
InfernoDOM.render(template(), document.getElementById('app'))

Arguments (can pass any number of them and in any order):

  • selector: class or id (string that starts with . or #).
  • attributes: object.
  • children: another element, a string or an array of strings or elements. NOTE: if need to pass a child string that starts with . or #, wrap it in []

About

Sugar syntax for creating inferno virtual DOM elements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages