This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-09
Channels
- # babashka (63)
- # beginners (97)
- # biff (11)
- # chlorine-clover (5)
- # cider (46)
- # clara (2)
- # clj-kondo (34)
- # clojure (65)
- # clojure-austin (1)
- # clojure-europe (9)
- # clojure-france (10)
- # clojure-italy (11)
- # clojure-nl (3)
- # clojure-spec (29)
- # clojure-uk (5)
- # clojuredesign-podcast (1)
- # clojurescript (56)
- # clr (6)
- # component (17)
- # conjure (5)
- # core-typed (5)
- # cursive (23)
- # data-science (5)
- # datahike (3)
- # dirac (3)
- # emacs (20)
- # fulcro (17)
- # graalvm (10)
- # graphql (8)
- # helix (99)
- # honeysql (7)
- # jobs-discuss (9)
- # juxt (9)
- # leiningen (14)
- # malli (3)
- # meander (6)
- # off-topic (77)
- # pathom (7)
- # re-frame (12)
- # reagent (8)
- # reitit (10)
- # restql (1)
- # shadow-cljs (22)
- # spacemacs (10)
Hi. Trying to start https://github.com/shadow-cljs/examples/tree/master/babel example, but got an error Cannot read property 'createElement' of undefined...
React exists in node_modules folder.
I'm finding a way to add js code to a reagent project.
you are likely importing react incorrectly, should be import * as React from "react"
.
commonjs -> ESM interop is in a weird place. wouldn't really recommend it too much currently.
import * as React from 'react'
did the trick, thank you. Should I create a PR on github?
Hi. Has anyone got suggestions for introductory hands-on Clojurescript material. Recent enough that it's not going to collapse in a muddle of broken dependencies and with enough context that you don't have to be thoroughly conversant with the modern JS ecosystem to know what's going on?
@roman01la @lilactown Apparently I failed to convey that I'm looking for something that's slightly more XPath-like and allows for the selection of nodes (e.g. select all child nodes that are of a certain element type).
I'd say just do it:tm: via interop then, document.querySelector is already good and afaik there's xpath dom api
@phil634
I'm not entirely sure what you are after, but perhaps use re-frame-template
to get a scaffold? We maintain it with very recent dependencies.
Is that what you are after?
to try the code at https://www.learn-clojurescript.com/section-1/lesson-8-capstone-weather-forecasting-app/ I created the project with
lein new figwheel cljs-weather -- --reagent
added the code and dependencies, and then ran
yarn
then opened the project in emacs, where I ran
cider-jack-in-clj&cljs
and the project opened in my browser. I can evaluate simple forms in core.cljs like (+ 1 1) with cider-eval-defun-at-point but trying to evaluate the ns form or, trying to get data from the web with (GET <some url>) causes me to get
Caused by java.lang.RuntimeException
Unable to resolve symbol: GET in this context
so, what do I have to do to be able to evaluate forms in my buffer as with clj in a cljs project?@patrickanium looks like you are evaling in the CLJ REPL since that is a CLJ error. I don't know how to switch your cider session to CLJS though.
I got a problem with metadata attached to a function
(defn make [] ^:matcher? (fn [x] x))
(meta (make))
this code works in clojure but throws ERROR - Unexpected token 'return'
in clojurescript
am I missing something and this behavior is documented somewhere?(function() {
cljs.user.make = (function cljs$user$make() {
return cljs.core.with_meta(
return (function(x) {
return x;
});, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null, "matcher?", "matcher?", (1159196681)), true], null));
});
return (
new cljs.core.Var(function() {
return cljs.user.make;
}, new cljs.core.Symbol("cljs.user", "make", "cljs.user/make", (2103882579), null), cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null, "ns", "ns", (441598760)), new cljs.core.Keyword(null, "name", "name", (1843675177)), new cljs.core.Keyword(null, "file", "file", (-1269645878)), new cljs.core.Keyword(null, "end-column", "end-column", (1425389514)), new cljs.core.Keyword(null, "column", "column", (2078222095)), new cljs.core.Keyword(null, "line", "line", (212345235)), new cljs.core.Keyword(null, "end-line", "end-line", (1837326455)), new cljs.core.Keyword(null, "arglists", "arglists", (1661989754)), new cljs.core.Keyword(null, "doc", "doc", (1913296891)), new cljs.core.Keyword(null, "test", "test", (577538877))], [new cljs.core.Symbol(null, "cljs.user", "cljs.user", (877795071), null), new cljs.core.Symbol(null, "make", "make", (356488202), null), null, (11), (1), (1), (1), cljs.core.list(cljs.core.PersistentVector.EMPTY), null, (cljs.core.truth_(cljs.user.make) ? cljs.user.make.cljs$lang$test : null)])));
})()
here is generate javascript. on 4th line there is extra return statementhowever this code works as expected
(defn make [] (with-meta (fn [x] x) {:matcher? true}))
(meta (make))
looks like a bug, post it to https://ask.clojure.org/ so it doesn't get lost in the slack void
it is already reported few times - https://clojure.atlassian.net/browse/CLJS-968#icft=CLJS-968
Hi(newbie here)!! is there a lightweight json
lib for cljs
(frontend) like cheshire
(for clj) or do people use some js-wrapped lib most of the time please?
(js/JSON.stringify (clj->js some-data-structure))
to serialize and (js/JSON.parse some-json-string)
to deserialize might be good enough for what you want to do.
cool thanks @chris358 do you know if there are some ways to keywordize
the clj datastructure in this case ? or do i have to do it manually
@delaguardo yeah an old bug, nobody's ever offered a patch for that probably because it's not that critical of a pattern, patch+test welcome
I guess this is the best place, but it's out of date. I'm going to add Helix and Hicada. Anything else I should add? https://clojurescript.org/community/libraries
I didn't add hx since it's superseded by helix. uix looks very nice! Feels like reagent but with nice support for hooks.
what's the recommended way to emit a #js {}
or #js []
from a macro? I'm guessing (cljs.core/js-obj)
/ (cljs.core/array)
? would these compile down to literals eventually?
I love the simplicity of setting up a new project with Next.js. What is the ClojureScript equivalent?
ClojureScript has "templates" which will create you a scaffold. Eg. re-frame-template or Luminus.
Thanks @U051MTYAB, this was really helpful!
I've used https://github.com/lambrospetrou/create-shadow-cljs-app and it was really neat. (disclaimer: I have no idea what next.js is)
@dnolen you once had cljs performance demo/test thing on the web that showed a huge grid of squares updating to show dom change speed (I think)... do you remember what that was or where it is?
itโs probably http://swannodette.github.io/2013/08/02/100000-dom-updates/ or one of the other links from that blog
@patrickanium to be clear that wasn't about dom change speed at all
rather using core.async to batch dom updates so a text field doesn't become unresponsive
but now wanting to update a grid like that with websocket data from a MIDI source, so it came to mind.
Is it possible to combine modules (https://clojurescript.org/reference/compiler-options#modules) and the new bundle target?