|
|
|
|
|
by pygy_
3939 days ago
|
|
With proper indenting and similar formatting: React: const links = ctrl.pages().map(page => <a href={page.url}>{page.title}</a>);
return <div> {links} <button onClick={ctrl.rotate}> Rotate Links </button> </div>;
Mithril: const links = ctrl.pages().map(page => m("a", {href: page.url}, page.title));
return m("div", [links, m("button", {onclick: ctrl.rotate}, "Rotate links")]);
There are JSX equivalents for Mithril too (for both Babel and standalone JSX).Mithril templates look also very good in CoffeeScript and similar languages. |
|