Batman.js rendering batman.js templates with React. Live on firebase.
- HTML templates are converted into React components (could be better: could be done at "compile"-time)
- JSX is invoked with
Batman.DOM
, whose functions return descriptor-like objects Batman.Controller::renderReact
puts components intodata-yield
containersrenderReact
is a drop-in replacement forrender
- During
render
, descriptors are enriched with one-way "bindings" that match the existing batmanjs binding API Batman.ContextObserver
stores observers forforceUpdate
-ing the component
Getting context into the components and observing it properly is not good yet.
ContextObserver
still has some leaks:
- Binding to new objects (eg the
newAnimal
form at the bottom of the home page) - It will keep tracking items that were removed from
data-foreach
collections :(
The whole injectedContext
idea is weak too: I spit POJOs into child descriptors so their bindings can lookup against them.
TODO:
- make observing/context not terrible
- support named default components (eg
AnimalsIndexComponent
) whose render functions are derived from HTML templates (a la batman.js default viewshttps://www.softcover.io/read/b5c051f3/batmanjs_mvc_cookbook/controller#sec-default_views) - implement the rest of the bindings
- add
data-component="#{myComponent}"
and use that fordata-view
, too - support HTML template => render function at compile time
Development:
$ npm install && npm install -g gulp
$ gulp