Change Log
Reusability
, Interoperability
Adding html
and attributes
template tags to use for SPA and SSR cenarios.
Use case
There are sometimes where we want to share functionality between 2 or more applications.
The most obvious ways is to use template literals because it's compatible with node & browser systems.
html, attributes are directives to be used on this context and we want more advanced features on template strings.
import { html, attributes } from 'jails-js/html'
export default function banner ({ attrs = [] }) {
return html`
[1, 2, 3].map( n => html`
<h1 ${ attributes( attrs ) }>
${n}
</h1>
`)
`
}
banner({
attrs : [{ title: 'Hello' }]
})
Output
<h1 title="Hello">1</h1>
<h2 title="Hello">2</h2>
<h3 title="Hello">3</h3>