This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-01
Channels
- # beginners (71)
- # boot (148)
- # cider (21)
- # cljs-dev (2)
- # cljsjs (35)
- # clojure (212)
- # clojure-russia (42)
- # clojure-spec (36)
- # clojure-uk (28)
- # clojurescript (18)
- # cursive (2)
- # datascript (20)
- # datomic (2)
- # hoplon (2)
- # off-topic (355)
- # om (2)
- # onyx (1)
- # protorepl (1)
- # reagent (34)
- # ring-swagger (6)
- # rum (8)
- # sql (4)
- # untangled (64)
- # vim (22)
- # yada (1)
you should never feel bad about code when you're just learning
Rather, you should never feel like the code you write makes you an abomination unworthy of ever handling code again. Bad code makes you feel pain that encourages you to write better code. 🙂
The app was written before my time, but anyways, we seem to be updating the state both from listening to changes to the history (eg user writes a url) and by updating the state atom.
What I’d like to achieve was while the user interacted with the application, the url of the app was a function of the state, but when the user manipulated the url, the state was updated to reflect this.
As the app is right now, once the app updates the history, we get an event from goog.history, which updates the state.
Is this causing any issues with maintenance or adding new things? If not I don't see how this is an issue. In my head, while view=f(state), the URL is under the same category as browser cookies and buttons on the page "the outside." That is, I think it's fine for History changed to make an event that changes state as well as state to update the history in the same way.
agree with emccue, it makes sense for the relationship to be two way, both you (the code) and the user (url bar) can update the location
Is anyone aware of what I should add to a project.clj to prepend a js file to my build automatically
or do you want it tree-shake, advanced compile along with the rest of your cljs->js code
@emccue If Cljs wiki is up-to-date, :preamble
doesn't work with :none
optimizations, but you can use :foreign-libs
: https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs (same as used by Cljsjs libs etc.)