Skip to content

v5.8.6 - Patch Update

Compare
Choose a tag to compare
@Javiani Javiani released this 05 Jan 17:19
· 3 commits to main since this release

Change Log

Consistency, Extensability

  1. Bug fix: There are some very edge cases cenarios where updating state from parent by emiting event from child onmount was rendering unexpected html output results. Adding a quick fix for those cases.

  2. Template "children" support.
    For cases where user wants to chare a web component using jails, There wasn't a easy way to wrap children with html code just like React and other frameworks does with children or slot features.
    So it was added on this version, a children prop for export const template() function in order to access children data from server rendered html.

Example

Consider a web component that have to wrap the default html children.

import { html } from 'jails-js/html'

export default function appTitle({ main }) {
  //
  main(() => {
      
  })
}

export const template = ({ children }) => {
  return html`
    <section>
      <h1>${children}</h1>
    </section>
  `
}
  import jails from 'jails-js'
  import * as appTitle from 'components/app-title'
  jails.register('app-title', appTitle)
  jails.start()
<app-title>My Title</app-title>

Output

<section>
  <h1>My Title</h1>
</section>