Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
You can’t perform that action at this time.