Fork me on GitHub
#clojurescript
<
2019-09-09
>
ag19:09:24

can someone tell me in this example: https://github.com/reagent-project/reagent/blob/363f2d4976ac077a289d7a5d46d41a22e15d723c/examples/material-ui/src/example/core.cljs#L4

(:require [reagent.core :as r]
          ["@material-ui/core" :as mui]
what’s the @ for?

gerred19:09:19

that's an npm organization

gerred19:09:28

so the actual npm package is "@material-ui/core"

ag19:09:55

but what’s the reasoning? Why?

gerred19:09:22

because that's how the material-ui org published it to npm. 😄

ag19:09:17

Ah… now that explains… Thanks!

gerred19:09:45

also npm modules have to be required as strings rather than symbols

gerred19:09:31

(if that helps any in explaining the difference :))

mfikes19:09:52

Symbols can be used for npm modules, so long as a legal symbol can be used. Strings are sort of an "escape hatch" when symbols can't be used to identify a library. (This could be thought of as a general thing, not specific to npm.) As an illustrative example, it is perfectly fine to (require '"clojure.zip") in a REPL.

💯 4
gerred19:09:13

AH! that's good to know

deadghost19:09:56

@mfikes I saw https://gist.github.com/mfikes/9fc981ed7a190b8e9b2912eee98fdd5e. Is there some way to deal with bigints today without using something as drastic as a cljs fork? I'm using cljs-ajax to get edn and the reader rounds my large integers

mfikes19:09:24

Sure, you could just use regular JavaScript interop. That gist is an experiment to see what it might mean to have them "integrated" into the language. But there is nothing stoping you from using them via interop today.

mfikes19:09:51

Not sure what to do about edn reading though...

Roman Liutikov22:09:12

Maybe use transit with custom handlers for bigint