rooch

Welp, wonder no longer - here's the answer. Full on choo architecture plus a couple preact goodies like h() and components. No JSX, only template strings via hyperx. But you can use JSX if you want to. We even support almost all of the React ecosystem through preact-compat.

🎉🎉🎉🎉

Why is this useful? Sometimes you gotta use react, and the best thing to do in that case is to jump on the preact train, grab a bag of architecture and go to town. This might not be for me, but perhaps it's useful for you. Here you go! 🎁

var html =require('rooch/html')

var rooch =require('rooch')

var app =rooch()

app.use(logger)

app.use(countStore)

app.route('/', mainView)

app.mount('body')

functionmainView(state,emit){

returnhtml`

<body>

<h1>count is ${state.count}</h1>

<buttononclick=${onclick}>Increment</button>

</body>

`

functiononclick(){

emit('increment',1)

}

}

functionlogger(state,emitter){

emitter.on('*',function(messageName,data){

console.log('event', messageName, data)

})

}

functioncountStore(state,emitter){

state.count=0

emitter.on('increment',function(count){

state.count+= count

emitter.emit('render')

})

}

See? Same same as choo!

Components

Everything in roochshould be the same, but things can be a little different for components:

In choo, stateful components are created using something like nanocomponent