Their value will now only be calculated as needed (i.e when deref
is called), which should make debugging them much easier.
This also makes updating the atom they are relying on cheaper.
Instead of passing an atom, you can now pass a function.
That function is passed one argument (the path provided to cursor)
when deref-ing, and two arguments (path and new value) when
resetting.
Remove the old setter, and the currying version.
Adds RCursor type: wraps Reagent's RAtom along with a path that provides focus into a specific part of that atom.
Adds reagent.ratom/cursor as a constructor for the RCursor type.
Adds reagent.core/cursor as the public API. This can be called with just a path, and returns a function that accepts a Reagent atom, or with both a path and an atom.
Dereferences of a cursor behave like get-in on the underlying atom with the specified path.
If you reset! a cursor, it behaves like a swap! assoc-in on the underlying atom. If swap! a cursor, it behaves like a swap! update-in on the underlying atom.