Coder Social home page Coder Social logo

batman-react-trial's Introduction

Batman.js & React

Batman.js rendering batman.js templates with React. Live on firebase.

The Good

The Bad

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.

The Ugly

TODO:

Development:

  • $ npm install && npm install -g gulp
  • $ gulp

batman-react-trial's People

Contributors

rmosolgo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

digideskio

batman-react-trial's Issues

data-showif's modifications to style aren't applied

This is about code on the better-context branch.

I use data-showif to modify a descriptor's props.style.display:

    style = @descriptor.props.style || {}
    if shouldShow
      delete style.display
    else
      style.display = 'none !important'
    @descriptor.props.style = style

(full source)

Here's an example from animals/show:

  <p data-showif='animal.animalClass | eq "Mammal"'>
    Mammalian
  </p>
  <p data-showif='animal.animalClass | eq "Reptile"'>
    Reptilian
  </p>

It works on initial page load, but not on subsequent renders when the data has changed. For example, if I change T-Rex to Mammal, it should hide "Reptilian" and show `"Mammalian".

It looks like the transformation is applied. You can see display: none !important in the React plugin:
image

But it doesn't seem like the DOM is affected. Both elements are visible:

image

And in the chrome inspector, neither one has style.display:

image

Idea

I haven't looked deeply at your implementation but you are saying that you have issues knowing when to update the React component.

A common pattern used by Meteor and Vue.js is to replace every time you read a value by a getter. What you do is run the function, see all the values that have been accessed, do a diff of what has been accessed during the previous round and add/remove the listeners accordingly.

This way, you can have arbitrary javascript code running and still have precise data binding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.