This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-26
Channels
- # beginners (91)
- # cider (34)
- # cljsrn (6)
- # clojure (95)
- # clojure-gamedev (4)
- # clojure-serbia (7)
- # clojure-spec (5)
- # clojure-uk (27)
- # clojurescript (42)
- # data-science (1)
- # datascript (2)
- # datomic (4)
- # duct (10)
- # emacs (11)
- # fulcro (21)
- # luminus (3)
- # lumo (24)
- # off-topic (2)
- # other-languages (2)
- # ring (2)
- # shadow-cljs (39)
- # spacemacs (9)
- # tools-deps (2)
one small difference b/w cljs and shadow loader is that the cljs version accepts a keyword as module name
I half expected to be able to resolve a symbol asynchronously and have the appropriate module loaded automatically; I guess this would require including a whole namespace->module index
I’m finding that the built-in resolve
macro is not exactly the thing I would want/expect for module loading; there’s no need to include the var’s metadata, and it shouldn’t be necessary to provide the symbol statically at compile time. I am looking at using a function like this instead:
(defn resolve-to-value [sym]
(->> (.split (str sym) #"[./]")
(map munge)
(to-array)
(apply gobj/getValueByKeys js/window)))
then I can pass symbols around as values instead of having to wrap them in the resolve
macro,
(def handlers {:home 'my-app.views.pages/home})
...
(resolve-to-value (:home handlers))
Otherwise, I had to use something like a case
statement
(defn handler-var [k]
(case k
:home (resolve 'my-app.views.pages/home))
I thought about adding async-require or something similar that would automatically do the shadow.loader
business.
(async-require
[[some.ns :refer (foo)]
[some.thing :as x]]
(x/bar)
(foo))
could take some :require
-ish forms and the body would execute when all required modules are ready
could even return a promise that would resolve to the final return value of that body
also wouldn't allow what you are after since the require forms would still be static
@kwladyka don't know any but (:require ["@material-ui/core/Button" :default Button])
[:> Button {:variant "raised" :color "primary"} "Hello World"]
might work
import React from 'react';
import Button from '@material-ui/core/Button';
const App = () => (
<Button variant="raised" color="primary">
Hello World
</Button>
);
the best I would like to use https://mdbootstrap.com, but this can be too difficult
https://github.com/mdbootstrap/React-Bootstrap-with-Material-Design as default they use webpack, not an issue?
honestly though. do not use that package. it is horrible. it does work but it is horrible.
just use https://material-ui.com/ directly