This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-17
Channels
- # beginners (26)
- # calva (7)
- # cider (6)
- # cljs-dev (7)
- # clojure (86)
- # clojure-europe (1)
- # clojure-finland (1)
- # clojure-spec (3)
- # clojure-uk (11)
- # clojurescript (18)
- # cursive (6)
- # data-science (1)
- # emacs (13)
- # fulcro (34)
- # juxt (8)
- # nrepl (6)
- # off-topic (11)
- # pathom (25)
- # re-frame (13)
- # reitit (11)
- # shadow-cljs (4)
- # spacemacs (3)
@kwladyka that appears to be a bug in figwheel. others have reported the same with and
. apparantely this fixes it https://github.com/bhauman/figwheel-core/pull/2
When using reagent, I have a component that needs to listen to keyboard events on the document when mounted. Is there an example, guide, or sample for how to best handle that?
Beginner question here: when I create a javascript object, e.g. (react/createContext "hi")
, from my repl, why do I get nil
back in the repl? However, I can also find the js object show up in the browser console. Is this the right behavior or did I mess up something? Thanks.
workshop.core> (react/createContext "hi")
nil
BTW I’m using shadow-cljs as my cljs repl. Not sure if this is relevant.
When invoked from the console in vanilla js does it return an object or is it a side-effect?
It returns an object:
React.createContext()
Object { "$$typeof": Symbol(react.context), _calculateChangedBits: null, _currentValue: undefined, _currentValue2: undefined, _threadCount: 0, Provider: {…}, Consumer: {…}, _currentRenderer: null, _currentRenderer2: null }
@dawranliou what’s happening is the CLJS printer is barfing on the Symbol(react.context)
JS value
you can fix it using these 4 lines:
(extend-protocol IPrintWithWriter
js/Symbol
(-pr-writer [sym writer _]
(-write writer (str "\"" (.toString sym) "\""))))
Thanks @lilactown ! This is very useful. I need this in all my cljs project now