Hacker News new | past | comments | ask | show | jobs | submit login

if your state is { foo: ['a','b','c'] }, you can either do:

    cursor.refine('foo', 3).onChange('d')
    cursor.refine('foo').onChange(['a', 'b', 'c', 'd'])
(indexes in a js array are the same as keys in a map)

It is possible to implement `push` and other list/object ops that are exposed by React.addons.update, they have not been implemented yet because they make the interface more complicated.

http://facebook.github.io/react/docs/update.html

I opened an issue for discussion: https://github.com/dustingetz/react-cursor/issues/10




Thanks, I was more wondering whether I can have something like :

  cursor.refine('foo').onChange({'child':{}});
in one place and then in some other, code that would dwelve inside that child recursively (and append the "add child" action to that node as well)

My goal is to have a json editor with json as the only model in the application and have react/cursor automatically render the tree, and allow its modification (removing and adding nodes).

Such functionality would require cursor to "dive" inside a json node without knowing its name - I'm not sure whether the 'push' op you are mentioning would be required to achieve this.




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

Search: