This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-20
Channels
Anything that javascript uses can be used in clojurescript, if you need sin(), you could use js/Math.sin ie. (.sin js/Math x)
For additional libraries, you could check out what's available in Clojure Toolbox: https://www.clojure-toolbox.com/
In the search bar if you type "Math", a few libraries come up with more advanced stuff
although, it looks like all of them are for clojure... so I guess that isn't much help
what's the easiest way to append a string into a dom element, don't seem to be finding a straightforward way. if I have a string, how can I create a dom node that I can easily append to another element's body
On that note, is there an easy way to get the metadata of a function in clojurescript
the clojurescript repl allows me to use (-> fn var meta :my-meta)
but the browser complains about calling var
@theeternalpulse You're still working with Dom elements similar to how you would do it in javascript, so you would access, create, append using js/document, js/window, etc
so to append to a dom element, assuming the dom element was elem
, you could do (aset elem "innerHTML" "the string")
so the doto was a gap I was missing
I ended up just declaring a block in the header with an ID and using reagent's render for it
but I like this since it can let me append instead of replacing
Hi, I'm attempting to get Figwheel to work with Stuart Sierra's Component library. My (Ring) server is a Component. I've tried using the figwheel-sidecar.system/figwheel-system
function that is described in the README of figwheel-sidecar
. This function is used to create the :figwheel
Component of my System. I have another Component for my application server (port 3000). The result is that when I visit localhost:3449
, I get an error message Figwheel Server: Resource not found, Keep on figwheelin'
. My application is available at localhost:3000
, and seems to work fine, but I guess without Figwheel support... I was hoping to get a figwheel-enabled version of my application when visiting port 3449. Any ideas of what I could be doing wrong?
What is the best way to use https://mdbootstrap.com/react/ with ClojureScript (re-frame)? Will it make issues?
mostly you just need to convert the jsx into function calls: <Button x={y}>Click</Button> into React.createElement(Button, {x:y}, "Click") - the fulcro docs have a good overview of the issues - the same applies to any cljs lib using react: http://book.fulcrologic.com/#_using_javascript_react_components
How to include this library into project? I guess I shouldn’t add ver. of mdbootstrap with react, because re-frame alread use react hmm. I am afraid doing this in ClojureScript will make more issues, than solutions. What do you think?
Like ClojureScript with mdbootstrap vs Vue with mdboostrap or ClojureScript with something supported
I'd recommend using shadow-cljs which just adds a friendly layer on top of the clojurescript compiler - the key feature is it makes using npm packages really easy and simple - https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
here's an example config: https://github.com/fulcrologic/fulcro-lein-template/tree/develop/resources/leiningen/new/fulcro/shadow-cljs
as far as picking a tech stack - the answer is always "it depends". Learning anything new always takes longer than you think, (Hofstadter's law) so it depends how much time you have, vs using something you know.
hey everyone. I’m getting a circular dependency error and cannot figure out how to solve it. so I have
routes.cljs
(:require [app.events :as events])
(defroute projects "/projects" []
(re-frame/dispatch [::events/set-active-page {:page :projects}]))
and I have
events.cljs
(:require [app.routes :as routes]) ;; importing the above file here
(re-frame/reg-event-db
::get-project-success
(fn [db [_ {project :data}]]
(-> db
(assoc-in [:loading :project] false)
(assoc :active-project project
:page-title (:title project)
:breadcrumb [{:label "Projects"
:path (routes/projects)} ;; and using it here
{:label (:title project)}]))))
routes is referenceing events and events is requiring routes
Hitting circular dependencies is usually a smell. You may need to re-think how to organise your code. I’d start by figuring out what are all the things your event-handler is trying to achieve atm and whether it should be doing all that or not. I mean, should the handler know anything about routing of your app in first place?
I have same issue with routes. I solved it by not requiring events in routes and typing the keyword like :app.events/set-active-page
.
@theeternalpulse I know the problem 🙂 I wasn’t sure how to solve it. @U662GKS3F thanks, I’ll try that!
yeah, sorry I missed the root problem