sinuous icon indicating copy to clipboard operation
sinuous copied to clipboard

Using render ...

Open artydev opened this issue 3 years ago • 0 comments

Hello, thanks for Sinuous

I found easier to use directly 'render' in my apps like the code below. I have bundled Sinuous /render and Unistore in a library called MVU, and renamed rhtml to html.

Eventually could 'render' be importesd from 'all.js' by default ?

The little problems is that I can't pass properties via <${...} myprop="abc" />

I would be glad to have your comments and you help

Regards

import { State } from "./state.js"
import { Actions } from "./actions.js"
import { Model } from "./model.js"

const {html, render} = MVU;

function View () {
  let state = State();
  return html `
    <h1>Counter ${state.counter || 0} </h1>
    <button onclick=${() => Actions.inc(1)}>INC</button>
  `
}

render(View, document.body);

You can test it here :

MVU

artydev avatar Jul 26 '22 22:07 artydev