Fork me on GitHub
#clojurescript
<
2020-09-10
>
Jeremie Pelletier03:09:06

Hello! I'm trying to use error boundaries in reagent and I can't seem to get the setState example to work; the error is caught and displayed, but the reset button with the call to .setState never updates the component is there something special to do for this to work?

Jeremie Pelletier03:09:26

the first example with the ratom does work however

jewiet09:09:12

Hello everyone, I want to mock responses from a server in a ClojureScript application and I am trying to figure out how to do it. I am using https://github.com/r0man/cljs-http and https://github.com/clojure/core.async libraries for making request. I have found https://github.com/myfreeweb/clj-http-fake but it is for Clojure. Is there a way to mock responses in ClojureScript?

athomasoriginal15:09:56

Are you looking to an E2E flow or do you just need the data? Depending on the goal, I usually do one of a few things: • stub the HTTP client to return response • setup a quick little server which returns the responses. • use spec to generate some random data as I need.

jewiet17:09:17

@U6GNVEWQG I just wanted the data. I managed to do it finally. Thank you for the suggestions:) I used similar approach to your first suggestion.

👍 3
jeremys15:09:06

Hi, I am trying to hack some functionality with keywords. My goal would be to have something similar to clojure's

clojure
(create-ns 'com.my-app.user)
(alias 'user 'com.my-app.user)
This lets me do ::user/namewithout creating the alias in the ns form and creating an empty com/my-app/user.cljs. Is there something I am missing that allows that? If not, is it a good idea to write a macro that would modify the clojurescript compiler's env state to add this namespace and alias? Is it even possible? Cheers

p-himik16:09:15

There's a Jira ticket for that. If you really want to work on such a functionality, it may be worth it to work on that ticket so that the functionality ends up in the core.

dpsutton15:09:00

sounds like a road of pain. why not just :user/name. why tie this to an actual namespace?

mfikes15:09:03

An interview with Chris Gammell, a portion of which goes into ClojureScript on the ESP32 hardware: https://contextualelectronics.com/cep005-clojure-script-on-hardware-with-mike-fikes

👏 6
jeremys15:09:30

@dpsutton it's the idea that :`my-app.user/name` is different than :your-lib.user/name . If we just use user/name there for instance would be a clash when both my app and your lib want to spec :user/name . Now I could use the long form everywhere but it would make for very long keywords in some cases.

andy.fingerhut18:09:10

I am not an authority on this matter, but having seen it discussed before, I think that several experienced Clojurians simply do use the fully qualified keyword everywhere, without aliases. Copy-and-paste helps avoid typing, but of course that doesn't make the keywords shorter when reading.