Skip to content
/ each Public

🧩 Even better HTML-based Reactive Template

Notifications You must be signed in to change notification settings

Bug-Duck/each

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eich Refresh

🧩 Even better Eich

Usage

See index.ts.

Example

import { eich, ref } from './eich'

const root = document.querySelector<HTMLDivElement>('#app')!

// Each
const app = eich`
  <var key="count" $value="0"></var>
  <button @click="count += 1">
    Count <value $data="count" />
  </button>
`
root.append(...app)

// Hybrid
function Count() {
  const count = ref(0)
  const handleClick = () => count.value += 1

  return eich`
  <button @click="${handleClick}()">
    Click Me! Count: <value $data="${count}" />
  </button>
  `
}

root.append(...Count())