nova-frontend
Version:
Nova is an alternative to all those gigantic front-end frameworks, that often do more than is necessary when it comes to building simple UIs. Pure Vanilla Javascript is performance-wise the best way to build your front-end in a SPA, but it can be hard to
20 lines (15 loc) • 582 B
JavaScript
import { Router, Group, Element, Generator, root } from '../../';
const wrapper = new Element('div', root, { id: 'wrapper' }, true);
const generator = new Generator;
const component = generator.createTree(`
div
h1 innerText: 'Router example.'
button innerText: 'Click it'
end`)
component.retrieve('button')[0].addEventListener('click', () => {
Router.changePath('/about');
})
const about = new Element('h1', root, { innerText: 'Hello there!'}).createComponent();
const group = new Group([component], wrapper);
new Router('/', [group])
new Router('/about', [about]);