Pronunced as /ɹiːˈfjuːəl/, refuel
The JavaScript framework that refuels your UI projects, across web, native, and embedded.
npm i refui
import { signal } from 'refui'
import { createDOMRenderer } from 'refui/dom'
import { defaults } from 'refui/browser'
const DOMRenderer = createDOMRenderer(defaults)
const App = () => {
const count = signal(0)
const increment = () => {
count.value += 1
}
return (R) => (
<>
<h1>Hello, rEFui</h1>
<button on:click={increment}>Click me! Count is {count}</button>
</>
)
}
DOMRenderer.render(document.body, App)
by using DOMiNATIVE alongside with NativeScript
import { Application } from '@nativescript/core'
import { document } from 'dominative'
import { signal } from 'refui'
import { createDOMRenderer } from 'refui/dom'
const DOMRenderer = createDOMRenderer({doc: document})
const App = () => {
const count = signal(0)
const increment = () => {
count.value += 1
}
return (R) => (
<>
<actionbar title="Hello, rEFui!"></actionbar>
<stacklayout>
<label>You have taapped {count} time(s)</label>
<button class="-primary" on:tap={increment}>Tap me!</button>
</stacklayout>
</>
)
}
DOMRenderer.render(document.body, App)
const create = () => document
Application.run({ create })
by using CheeseDOM alongside with Resonance
import { document } from 'cheesedom'
import { signal, t } from 'refui'
import { createDOMRenderer } from 'refui/dom'
const DOMRenderer = createDOMRenderer({doc: document})
const App = () => {
const count = signal(0)
const increment = () => {
count.value += 1
}
return (R) => (
<>
<label attr:centered y={-20}>rEFui + Resonance</label>
<button attr:centered y={20} on:clicked={increment}>
<label attr:centered>{t`Count is ${count}`}</label>
</button>
</>
)
}
DOMRenderer.render(document, App)
/** @jsx R.c */
/** @jsxFrag R.f */
Set these values accordingly to your transpiler configuration, or add the above comments to the top of your JSX file.
See Components
You're building your app with a toolchain/compiler/transpiler anyways, so there's no need to provide a prebuilt version.
MIT