Skip to content

Instantly share code, notes, and snippets.

@dagingaa
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagingaa/53d6910a3b681601123f to your computer and use it in GitHub Desktop.
Save dagingaa/53d6910a3b681601123f to your computer and use it in GitHub Desktop.
// The following is a thought experiment of how it COULD work
// todos-template.js
export default (todos) => {
return `
<div class="todo-wrapper">
<p>Remaining: ${ todos.length }</p>
<ul class="todos">
${ todos.map(todo => `<li class="${ todo.completed }">${ todo.text }</li>`) }
</ul>
</div>
`;
}
// main.js
import TodosTemplate from "todos-template";
import ReactView from 'react';
class TodosView extends ReactView {
constructor() {
super();
this[todos] = [];
}
render() {
return TodosTemplate(this[todos]);
}
}
var todosView = new TodosView();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment