Skip to content

Instantly share code, notes, and snippets.

@rsslldnphy
Created February 4, 2015 15:36
Show Gist options
  • Save rsslldnphy/35ae343f46133e844256 to your computer and use it in GitHub Desktop.
Save rsslldnphy/35ae343f46133e844256 to your computer and use it in GitHub Desktop.
cursor issue
ClojureScript:bugs-web.formatters> (def a (atom {}))
#<Atom: {}>
ClojureScript:bugs-web.formatters> (swap! a assoc :a 2 :b 3)
{:a 2, :b 3}
ClojureScript:bugs-web.formatters> (require '[reagent.core :as r])
ClojureScript:bugs-web.formatters> (def r (r/atom {}))
#<Atom: {}>
ClojureScript:bugs-web.formatters> (def rc (r/cursor [:x] r))
#<Cursor: [:x] #<Atom: {}>>
ClojureScript:bugs-web.formatters> (swap! rc assoc :y 3 :z 4)
{:x {:y 3, (:z 4) nil}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment