Quantcast
Channel: How to update Reagent vector in an atom - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by grandinero for How to update Reagent vector in an atom

Just to explain a little more, when you do (swap! (:toppings order) ...), you are retrieving the :toppings key from order, which would make sense if it were a map, but it's an atom, so (:toppings...

View Article



Answer by user2609980 for How to update Reagent vector in an atom

I would turn toppings into a set. I don't think you want duplicate toppings in the collection, so a set is appropriate:(defonce order (r/atom {:first-name "" :last-name "" :toppings #{}})) ; #{}...

View Article

Answer by Minh Tuan Nguyen for How to update Reagent vector in an atom

You can update toppings with:(swap! order update :toppings conj "Pepperoni")

View Article

How to update Reagent vector in an atom

I've got a Reagent atom:(defonce order (r/atom {:firstName "" :lastName "" :toppings [] }))I want to add toppings to the :toppings vector. I have tried many variations on:(swap! (:toppings order) conj...

View Article
Browsing latest articles
Browse All 4 View Live


Latest Images