Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks! Yes, the API is very simple. And indeed:

(1) It does work with React natively, and in fact the example I gave above uses React under the hood. Here's how to do the same thing with raw react:

    <script src="https://stateb.us/client6.js"></script>
    <script>
    var body = statebus.create_react_class({
      render: () => {                          // This function will re-run whenever
        return React.DOM.div(                  // any state fetched below changes
            {style: {backgroundColor: '#eef'}},
            'The time is ',
            fetch('state://server.com/time').now,
            ' and the weather is ',
            fetch('state://another.org/weather/oakland,ca').brief
        )
      },
      displayName: 'body'
    })

    setTimeout(_=> React.render(body(), document.body))
    </script>
You can put that into a .html file and run it directly in your browser with a file:// URL.

I would love to help you give it a try and see what you think! Please send me an email or text (toomim@gmail.com or 510-282-4312) for feedback and assistance.

2) We are currently OT/CRDT/Version Control into it. We've come up with a new approach here, which I'm very excited about. I'm also looking for folks to beta-test or give early feedback on our approach as we polish it up.

I'm also interested in adding Vue support. If you'd like it, I'll add it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: