This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-23
Channels
- # announcements (7)
- # babashka (11)
- # babashka-sci-dev (1)
- # beginners (8)
- # biff (1)
- # calva (8)
- # chlorine-clover (3)
- # cider (9)
- # clj-kondo (16)
- # cljdoc (9)
- # clojure (79)
- # clojure-australia (1)
- # clojure-dev (5)
- # clojurescript (24)
- # data-science (3)
- # datomic (2)
- # emacs (54)
- # fulcro (1)
- # graalvm (1)
- # jobs (5)
- # lsp (25)
- # malli (7)
- # meander (10)
- # off-topic (44)
- # other-languages (8)
- # portal (10)
- # remote-jobs (1)
- # sci (1)
- # shadow-cljs (6)
- # vim (4)
Hi, I'm trying to setup storybook to my re-frame template project. Can't make it really work, I get this error in storybook Couldn't find any stories in your Storybook. does anyone did this before in re-frame?
Just in case - I'm 95% sure it has nothing to do with re-frame. The Storybook tutorial states: > The story is a function that returns a rendered element (i.e., a component with a set of props) in a given state---exactly like a Functional Component. If that's always the case, then you definitely have to jump through some hoops to make Reagent components work with Storybook as by default they are class components and not functional ones.
And if that template you're using claims to have Storybook support built into it, I would create an issue in the template's issue tracker right away.
To be quite honest I dont think this has anything to do with re-frame either. I’d recommend checking the following links: • https://shaolang.github.io/posts/2021-02-14-storybook.js-with-shadow-cljs/ • https://github.com/DavidVujic/clojurescript-amplified
I have made an example project combining ClojureScript and Storybook that might help: https://github.com/DavidVujic/clojurescript-amplified Have a look at the shadow-cljs.edn - I recognize the error message you get and think it might be how ClojureScript and Webpack work together.
I have an interop call like this (.toISODate (luxon/DateTime.now))
and I’m trying to convert it to a shorter version.
How would you make it shorter? There are no extra symbols that you could even potentially remove.
Regarding "up to date guides" - pretty sure nothing has changed since forever, so pretty much any guide should be good.
This should work, but it's of the same exact length: (.. luxon/DateTime now toIsoDate)
.
That’s the issue with the guides. I’ve opened the first link from google search clojurescript js interop
https://lwhorton.github.io/2018/10/20/clojurescript-interop-with-javascript.html and checked “Function invocation” section. It mentions the invocation like this (. js/document hasFocus)
but not like this (js/document.hasFocus)
So I wonder if there is a complete guide…
None that I have found that I imagine match what you’re looking for (because I remember wanting the same things as well when I started!). However, I did find that https://clojure.org/reference/java_interop is more helpful than it would initially seem because the concepts carry over to ClojureScript.
This page is linked by the official CLJS website: https://cljs.info/cheatsheet/
It's only a cheatsheet so it doesn't go into the details, but a.b
kind of access is there.
Note that such kind of field access is "unofficial" (probably why it's usually not mentioned in all sorts of guides) but it's working and will continue to work.
Regarding Java interop - not all the concepts carry over unfortunately. In fact, when using interop to its fullest, in terms of differing lines of code there will be more differences than commonalities, just because of all #js
and ^js
. But depends on the project and the task at hand, of course.
This one is pretty good and thorough: https://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/ but it also doesn't mention js/document.hasFocus
as a possible way either I don't think
Thank you, @U9J50BY4C. At least it mentions the new
constructor dot syntax like (def date (js/Date.))
@U050B88UR are there any official docs for the js interop?
I wrote up things about interop I didnt find sufficient docs for https://widdindustries.com/clojurescript-jsinterop/
which talks about the a.b thing aka dot access
https://cljs.github.io/api/syntax/dot and a bug it has https://clojure.atlassian.net/jira/software/c/projects/CLJS/issues/CLJS-3315
That Jira link should now be https://clojure.atlassian.net/browse/CLJS-3315 since the URL format seems to have changed.