Fork me on GitHub

What are the options of state management for reagent?


I know re-frame, keechma, petrol, "simply use swap, what else do you need?" and "roll your own"


I guess you could use re-frame only for processing actions, ignoring the subscriptions?


added to the gist


@pesterhazy I also update this list from time to time, but not every lib is strictly about Reagent:


cool - you're right, state management doesn't have to be about reagent at all


is there a way to get the HTML string from a react component? (fn bootstra-popover-content [] (fn [content] [:div content])) => <div...


you're the man! (presumably)


Hi all, I’m getting an error Error: Assert failed: Invalid tag: 'F#' (in tabber.core.Chords) when trying to perform (map #(str/split % #"/") song) on ... F#/m7/4 .... It is a music app so I need to be able to use # but any chord that uses it throws an error. Any way to escape that? Never had this error in React or any other language so not sure how to proceed. thx!


Here is the trace if that helps

(defn parse-tag [hiccup-tag]
  (let [[tag id class] (->> hiccup-tag name (re-matches re-tag) next)
        class (when-not (nil? class)
                (string/replace class #"\." " "))]
    (assert tag (str "Invalid tag: '" hiccup-tag "'"
    #js{:name tag
        :id id
        :className class}))


you're usiing F# as a component - that seems wrong


@pesterhazy hmmm. I’m just converting a long string of a/b/c a/b/c a/b/c to a list of ( ["a" "b" "c"] ["a" "b" "c"] ...) that is then being fed into a component but as for using F# as a component…. it is used the same as all other characters without a trailing # and those have no error. Seems to be how the # is being interpreted.


the first element of a vector is treated as a component or tag


perhaps you want to start off the vector with something like :span before the note strings


@noisesmith Oh I see… Sorry @pesterhazy didn’t catch that meaning. But why do I have no problem with all the other notes with no #? I can’t really add a span in front of these because I’m using them as strings. I can rework my solution but I’d like to udnerstand why I’m having the issue since it is likely to come up again. thx


I wouldn't think about "what is different?" but "why is it blowing up?" - you must be doing something fishy there. But we can't see that because it's not in the snippet you posted


It is this long chain that surely needs refactoring

as-> songInfo song
        (first song)
        (drop 2 song)
        (map #(str/split % #" ") song)
        (apply concat song)
        (filter #(not (str/blank? %)) song)
        (map #(str/split % #"/") song)
        (cons ["X" "X" "4"] song)
        (swap! state/app-state assoc-in [:song] song)))


the map / apply concat lines can be replaced with (mapcat #(str/split % #" ") song)


something ends up as the first element of a vector which is interpreted by reagent as a component


@pesterhazy Ok, I’ll trace everything through and see what I’m doing. Still at the hacking stuff together phase of learning. Thanks for the help


@pesterhazy I was displaying the final transformed data in my view for debugging and sure enough, that was the issue. Thanks again.