I actually use backbone and react right now and love it. I also thought flux was too much, so I'm very interested in a framework like this.
I actually use backbone and react right now and love it. I also thought flux was too much, so I'm very interested in a framework like this.
- A small library that you can read and hack easily
- No templates or HTML/JSX in your JavaScript
- Models & Collections are small wrappers around Objects & Arrays
- Declarative DOM representation provides a simple binding between views and models (optional)
- One-directional data flow
- Child components are managed automatically (no zombie views)
- Proper Collection.set performs a smart update without relying on sorting
- Built-in List component for displaying a list of models
This is very nice. I just have a few questions:
- is it possible to reuse markup from one place in another without copy-paste? (e.g. let's say I have a pagination control that I want to display both above below a table)
- how would you hook a third party library (e.g. let's say I need to use select2.js or pikaday.js)?
- is it possible to render things on the fly? (e.g. asynchronous modules) or does all of the HTML need to be on the page on page load?
sure, you can just place the markup in a hidden div and clone the node. or you can pass a string as the view name:
new Controller({ view: 'node-id' })
and the framework will do that for you: document.getElementById('node-id').cloneNode(true) and cache the node as well
we typically have a hidden div which contains all re-usable nodes that the app needs
> how would you hook a third party library
you can do anything you want in the init() method, just like backbone. this.view is the view node, and you also have access to this.ref[node-name]. you're not forced to user the render sugar the framework provides at all, eg the List class doesn't use it and updates the DOM imperatively.
> is it possible to render things on the fly
you can always fetch html from the server and do createElement() to generate a node from that, or inject the html/template into the page body. if you prefer to have html templates separate, you can just have your build script inject the templates into the body which makes the app much faster anyway in my experience.