nil/recur

  • If the state is undefined , return the initial state for this reducer.
  • Note in particular that the shape of the state tree does not have to correspond to the shape of the render tree.
  • (defn sent-reducer ([] []) ([state action] (if (= (:type action) :email-sent) (conj state (:payload action)) state))) (let [initial-state (sent-reducer) actions [{:type :email-sent :payload {:to “strax@example.com” :title “Hi!”

Read the full article, click here.


@jonasenlund: “I wrote a blog post on #reactjs #redux reducers in #clojure:”


Redux is a Javascript library with an interesting approach to doing client side state management. It is inspired by the Flux architecture and is most often used in combination with React. Redux takes a very functional approach to state management which could potentially be interesting to many Clojure programmers.


nil/recur