This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-02
Channels
- # aleph (25)
- # announcements (17)
- # aws (2)
- # babashka (72)
- # beginners (44)
- # calva (6)
- # cider (3)
- # clj-kondo (109)
- # cljfx (1)
- # cljsrn (31)
- # clojure (151)
- # clojure-austin (1)
- # clojure-europe (36)
- # clojure-nl (5)
- # clojure-norway (2)
- # clojure-spec (17)
- # clojure-uk (12)
- # clojurescript (74)
- # cursive (57)
- # data-science (1)
- # datascript (28)
- # datomic (40)
- # depstar (15)
- # gratitude (3)
- # helix (3)
- # introduce-yourself (1)
- # joker (1)
- # kaocha (2)
- # leiningen (2)
- # lsp (70)
- # lumo (2)
- # malli (2)
- # meander (4)
- # off-topic (10)
- # polylith (27)
- # quil (4)
- # re-frame (18)
- # reagent (24)
- # ring (4)
- # rum (1)
- # shadow-cljs (102)
- # sql (2)
- # tools-deps (48)
- # web-security (8)
- # xtdb (5)
Hello 👋, what does this error means?
react_devtools_backend.js:2850 Warning: Invalid attribute name: `cljs$lang$protocol_mask$partition0$`
at div
at eval ()
at exports.CustomGallery ()
at f ()
at div
at div
at cmp ()
at div
at div
at div
at div
at cmp ()
the code
(ns quagga.components.dataview.photos.view
(:require
[reagent.core :as reagent]
["react-photoswipe-gallery" :refer (Gallery Item)]))
(defn photos-component
[]
[:div.tab-page.photos-page {:style {:display "block", :overflow-x "scroll"}}
[:div#tab-contentphotos.tab-content
[:f> Gallery
;; {:id "simple-gallery"}
[:div
{:style
{:display "grid"
:gridTemplateColumns "240px 171px 171px"
:gridTemplateRows "114px 114px"
:gridGap 12}}
[:f> Item
{:id "so-first"
:title "Author: Folkert Gorter"
:height "1600"
:width "1600"
:thumbnail
""
:original
""}
(fn [ref open]
(reagent/as-element
[:img
{:src ""
:ref ref
:on-click open
:style {:cursor "pointer"
:objectFit "cover"
:width "100%"
:maxHeight "100%"}}]))]]]]])
but now I get this warning
react_devtools_backend.js:2850 Warning: Unexpected ref object provided for img. Use either a ref-setter function or React.createRef().
at img
at exports.Item ()
at div
at exports.CustomGallery ()
at exports.Gallery ()
at div
at div
at cmp ()
at div
at div
at div
at div
at cmp ()
This is the signature in the documentation, in JS: ({ ref, open })
Your signature: [ref open]
Do you notice the problem?
Hi! I'm trying to create a component (for use with Re-frame) of a Google Maps map, more or less like this https://gist.github.com/jhchabran/e09883c3bc1b703a224d#file-2_google_map-cljs
and I have a few questions about it.
In the example, gmap-component
is given the @pos
argument, but the gmap-component
function does not take any arguments. How does that work? In the example, they use (reagent/props comp)
but for me that returns nil
. But it looks like they are getting the position by doing that. Maybe that worked in an earlier version?
When I add an argument to the definition of gmap-component
, and re-frame/subscribe
has detected a change, the component's update
function will run, but if I refer to the argument (of gmap-component
) in the update
function it is always the same as the first time.
What I want to achieve is a way to update the component (with the update
function) but receive a new value from re-frame/subscribe
somehow, as with regular, simple re-frame views. Any ideas?
> but the gmap-component function does not take any arguments It doesn't matter because it's JavaScript - you can have functions with no arguments receiving many and functions with many arguments receiving none. > but for me that returns `nil` With the exact same code?
That part is essentially the same. This is my code https://gist.github.com/oskarkv/1efa76628224ceeb23704211fb687c33
As you can see, I'm playing around with stuff. Anyway, do you know of a way to pass in the new, updated value from the re-frame db to the component's update function? It seems ugly to keep a reference to the atom in the component, since re-frame/subscribe
is what triggers the updates.
I use reagent.core/props
function on the first argument to the :component-did-update
and :component-did-mount
just fine with Reagent 1.1.0.
> do you know of a way to pass in the new, updated value from the re-frame db to the component's update function?
Pretty much what you're doing already. Make complex components by decoupling re-frame and Reagent - create a plain Reagent component, without any ratoms, that does all the job and updates all the necessary things in its lifecycle functions. And then wrap it in a re-frame component that feeds the Reagent one all the necessary values from subscriptions.
But it seems that the component is already created when I change the re-frame db, and the gmap-component
function is just called once. So when update
refers to the argument it's always the same as the first time. So, what I'm doing is not right. 😛
That function is supposed to be called once. And the first argument to the lifecycle functions is the relevant instance of that component, so of course it will be the same as well. Everything is correct here.
From the documentation: > the arguments to your render function are actually passed as children (not props) to the underlying React component, unless the first argument is a map
Hey all, how do I pass a component as a prop? Trying to use https://primefaces.org/primereact/showcase/#/dataview and stuck on supplying the itemTemplate