made with esnextbin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const html = choo.view | |
const onload = require('on-load') | |
const app = choo() | |
app.model({ | |
state: { | |
title: 'Hello' | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const html = choo.view | |
const onload = require('on-load') | |
const app = choo() | |
const page1 = (params, state, send) => { | |
const tree = html` | |
<div> | |
<h1>Page 1</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const html = choo.view | |
const onload = require('on-load') | |
const app = choo() | |
const sampleData = { | |
authors: [ | |
{ name: 'George' }, | |
{ name: 'John' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const knex = require('knex')({}) | |
console.log('accessing table') | |
knex.schema.table('users', function (table) { | |
console.log('inside') // this is never called | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var html = require('bel') | |
var text = html('<p>Some text</p>') | |
var el = html`<div>${text}</div>` | |
document.body.appendChild(el) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const connect = require('throw-down/connect') | |
// Sample log functions | |
const constructed = (node) => console.log('constructed', node) | |
const added = (node) => console.log('added', node) | |
const mutated = (node) => console.log('mutated', node) | |
const removed = (node) => console.log('removed', node) | |
const app = choo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const http = require('choo/http') | |
const yo = choo.view | |
const app = choo() | |
app.model({ | |
state: { | |
users: [] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const choo = require('choo') | |
const app = choo() | |
app.model({ | |
state: { | |
fetched: false, | |
items: [] | |
}, | |
reducers: { | |
receive: (action, state) => ({ items: action.items, fetched: true }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendAction = require('send-action') | |
const assert = require('assert') | |
const send = sendAction({ | |
state: { | |
a: 123, | |
b: 456 | |
}, | |
onaction: (action, state) => ({ b: action.value }), | |
onchange: (params, newState, oldState) => { |