This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # beginners (50)
- # boot (80)
- # calva (4)
- # cider (58)
- # cljs-dev (11)
- # clojure (140)
- # clojure-brasil (1)
- # clojure-denver (1)
- # clojure-dev (10)
- # clojure-europe (8)
- # clojure-finland (2)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-quebec (1)
- # clojure-spec (2)
- # clojure-sweden (4)
- # clojure-uk (94)
- # clojurescript (98)
- # cursive (19)
- # data-science (1)
- # datascript (9)
- # datomic (43)
- # emacs (2)
- # fulcro (29)
- # graphql (41)
- # hoplon (15)
- # jobs (2)
- # kaocha (4)
- # liberator (24)
- # off-topic (9)
- # perun (1)
- # re-frame (11)
- # reagent (17)
- # reitit (8)
- # remote-jobs (2)
- # rum (2)
- # shadow-cljs (24)
- # spacemacs (1)
- # specter (1)
- # tools-deps (21)
Hi eveybody ! Which is the best way to create reusable component using Reagent & co. Eg. React have CSS module to import CSS in an component scope like :
import React from 'react'; import './SearchBar.css';
I am not sure if I understand this question. A Reagent Component is a function right? Functions you can reuse (require them if they are in a different namespace). What exactly do you mean?
https://github.com/kwladyka/form-validator-cljs/tree/doc here you have my stack how to do it
the main point is https://github.com/kwladyka/form-validator-cljs/blob/doc/src/js/index.js
@UFBL6R4P3 I think you are referring to making the
import './SearchBar.css'; work in your
.cljs file, yes?
is there a known problem with the cljs compiler not being able to find namespaces sometimes? it seems that they’re all namespaces which I’m using for keyword aliasing
@mfikes thanks, it might be a figwheel-main thing. I don’t understand the cljs toolchain as deeply as I’d like...
There is some "cljs web debug playground" where I type cljs in one side and see the "pprinted output" in the other side?
so I have this weird thing going on with my cljs repl since I switched to deps.edn over an nrepl connection. If I send multiple forms to the repl (or copy paste multiple forms into the repl), only the first will be evaluated
before I was able to send a bunch of things to the repl to be evaluated all at once
Can anyone thinlk of what troubleshooting steps I might take to help narrow down this problem?
like experiments I could run or something to see where in the pipe this is being caused?
i'd appreciate if you
lein install that branch and try it out and leave feedback on the ticket
Hi guys, just found this awesome tutorial for loading third-party npm modules in ClojureScript https://gist.github.com/pbostrom/87500c8c3fa43b23cd3ccd764ef767d5 Is that the state of the art way to do it right know? Just found at @yogthos awesome project.clj file https://github.com/yogthos/reagent-dnd/blob/master/project.clj that uses :npm-deps key but couldn’t make it work
I can’t take too much credit for that, somebody else did most of the work and I just updated it to work with the latest react-dnd 🙂
Yogthos approach feels shorter and cleaner but don’t know the steps to make this work
@leontalbot here https://github.com/kwladyka/form-validator-cljs/tree/doc you have full example how to use npm deps with fighweel-main
@kwladyka Thanks a lot, I have a lein project, do you think it makes much difference?
https://github.com/kwladyka/form-validator-cljs/blob/doc/figwheel-main.edn#L1 fighweel-main do some automatisation here
if you are not using figwheel-mian you have to write map for that manually point to https://github.com/kwladyka/form-validator-cljs/blob/doc/src/js/index.js
which in similar to the gist approach https://gist.github.com/pbostrom/87500c8c3fa43b23cd3ccd764ef767d5
yes, but I prefer to learn from real code and solution. Much easier for me to adapt.
hmm I have this feeling people ask about the same question everyday. Can I make from this repo example in some visible place?
I can write article probably, but where to publish it? I have http://clojure.wladyka.eu but it is not popular blog 😉
To be honest I am not familiar with reddit too much. It is not popular in my country at all. I don’t have even account there 😉
Does shadow-cljs makes it easier to integrate cljs into js project where both js and cljs projects depend on React (or other JS deps)?
either way you'll probably declare React as an external dependency, and need to create a way providing it to your application
the user guide has a lot of information: https://shadow-cljs.github.io/docs/UsersGuide.html
Here’s how I’m doing it now https://github.com/roman01la/reagent-react-integration is there anything that shadow can make easier?
OMG. I don't even know where to begin ... yes
shadow-cljs will make this a billlion times easier.
@U05224H0W I didn’t find anything on that in the guide. Could you please share anything related?
integration itself is simplest with https://shadow-cljs.github.io/docs/UsersGuide.html#target-npm-module
you could drop webpack entirely for this example and just let shadow-cljs compile everything
really no need for webpack unless you want css bundling which shadow-cljs doesn't currently do
That’s amazing! Is shadow’s output compatible with cljs compiler output? AFAIK you’ve made some changes to the compiler that are not present in cljs, or is it only closure?
it is using the default CLJS compiler with just some modification related to how JS/npm is handled
hmm, IIRC there was something about fixing resolution of macros and functions that have the same name?
basically don't worry about it. it uses CLJS 1.10.439 and just fixes a few odd things related to JS handling
hm, ok. These small changes are in fact what keeps me out of shadow. But I’ve never had an opportunity to make sure that it doesn’t make shadow incompatible with cljs. So if everything is ok, that’s super great!
there are some shadow-cljs only features but as long as you don't use them thats fine 😉
That’s great. Are those
shadow.js.shim.module\$.. modules autogenerated for NPM deps?