A Pen by Jason Miller on CodePen.
This file contains 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
/** | |
* Our component structure will look like the following: | |
* - WikiBox | |
* -- AutoCompleteBox | |
* --- AutoComplete | |
*/ | |
/** Renders a single entity coming from wikipedia */ | |
class AutoComplete extends React.Component { | |
render() { |
This file contains 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
import React from 'react'; | |
export class Component extends React.Component { | |
constructor(...args) { | |
super(...args); | |
this.generateBindings(); | |
if (typeof this.init==='function') { | |
this.init(); | |
} | |
} |
This file contains 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 jpr = new JSONPRequest(); | |
* jpr.onload = (...data) => { | |
* console.log(data); | |
* }; | |
* jpr.open('GET', 'some-url?callback={{callback}}'); | |
* jpr.send(); | |
*/ |
This is a really basic "todo list" demo built with Mithril.
It's largely an ES6/ES2015 port of the Mithril's Getting Started guide, with a bit of sugar and opinion thrown in to make it look and feel a lot like React.
In this case we're using Babel's JSX transform to convert inline XML into hyperscript (just nested calls to Mithral's m()
function).
A Pen by Jason Miller on CodePen.
Moved to my new blog: jasonformat.com/wtf-is-jsx
It's actually really straightforward. Take 1 minute and read this.
You declare this per-file or per-function to tell your transpiler (eg: Babel) the name of a function that should be called (at runtime) for each node.
This file contains 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
/** Typed DOM node factory with reclaimation */ | |
let recycler = { | |
collect(node) { | |
recycler.clean(node); | |
let name = node.nodeName, | |
list = recycler.nodes[name]; | |
if (list) list.push(node); | |
else recycler.nodes[name] = [node]; | |
}, | |
create(nodeName) { |
This file contains 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
/** Bind a method to lexical scope. | |
* @example | |
* class Foo { | |
* @bind | |
* bar() { | |
* assert.ok( this instanceof Foo ); | |
* } | |
* } | |
*/ | |
export default (target, key, { value: fn }) => ({ |
This file contains 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
let behaviorA = { | |
greet(greeting) { | |
return greeting; | |
} | |
}; | |
@mixes(behaviorA) | |
class Foo { |
This file contains 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
{ | |
"firebase": "your-app-name-here", | |
"public": "build", | |
"ignore": [ | |
"firebase.json", | |
"**/.*", | |
"**/node_modules/**" | |
], | |
"rewrites": [ | |
{ |