This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-25
Channels
- # announcements (8)
- # aws (50)
- # aws-lambda (6)
- # babashka (25)
- # beginners (119)
- # bristol-clojurians (5)
- # calva (25)
- # chlorine-clover (23)
- # cider (6)
- # cljs-dev (125)
- # clojure (63)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-dev (48)
- # clojure-europe (11)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-uk (66)
- # clojurescript (14)
- # core-logic (5)
- # datomic (13)
- # emacs (10)
- # events (2)
- # fulcro (37)
- # graalvm (11)
- # hoplon (95)
- # jobs-discuss (9)
- # juxt (11)
- # kaocha (16)
- # meander (13)
- # off-topic (24)
- # pedestal (4)
- # re-frame (36)
- # reagent (10)
- # reitit (15)
- # ring-swagger (5)
- # shadow-cljs (23)
- # spacemacs (2)
- # sql (13)
- # tools-deps (32)
- # xtdb (11)
morning!
I'm really glad its so sunny, if it was grey and rainy i think that would negatively impact people a lot more
do any of you use React Router
I'm trying to extract the value of a path param from a Route; all the children components are function-as-React-Components I can see that the
{:history :location :match}
exist as Props in my component
but sinceits a component-as-function, I don't know if I can access themI can cobble something together with a `
:render
(fn [m]
...
js/m.match.params.id)
but it doesn't feel quite rightReact DevTools tells me that the thing I want exists as a Prop
but I don't know how to access the Prop from within the component function
theres an assumption that component props are just params passed in to the function
hmmm. its a Router.Provider
div that has the Props in it
@ben.hammond Looks like react-router has hooks for this now, if you'd prefer that https://reacttraining.com/react-router/web/api/Hooks
ah. that's what I was missing!
I want the matches, and the hook is called useHistory
but I bet it returns the whole data structure
probably
so this works for me
(defn with-matches []
(let [m (router/useRouteMatch "/board/:id")]
(.log js/console "m is " m)
[:h2 "params.id: " js/m.params.id]))
called from within
[:> router/Switch
[:> router/Route {:path "/board"}
[with-matches]]
slightly niggles that I have to specify the path twice but on a worldwide scale not a biggie
thanks!
Yeah, just be aware of the hooks rules and all that jazz (ie, never invoke a hook in an if
or a loop)
not a problem there obviously
well it IS within a Router switch
my plan B is to encase the :render
property in syntactic sugar
something like
(defn with-route
[props child]
[:> router/Route
(assoc props
:render
(fn [m]
(.log js/console "m is " m)
(uix/as-element [child m])))])
wow, they've really gone hooks-mad
react-router knowledge famously ages badly π
Just for the record, this seems to work just fine
(defn with-params []
(let [m (router/useParams)]
(.log js/console "m is " m)
[:h2 "params.id: " js/m.id]))
...
[:> router/Switch
[:> router/Route {:path "/board/:id"}
[with-params]]
morning
hey Bristol's Clojure meetup is online tonight (6pm - 8pm): https://www.meetup.com/Bristol-Clojurians/events/zdfnqrybcfbhc/ if you'd like to join us we're in #bristol-clojurians π

@UCJCPTW8J Hi, will this be recorded? I'm not available at that time but really interested in this.
I don't think that's the initial plan, but we should consider it once we find our feet
cool just got an email "Tomorrow we will officially relaunching http://skillsmatter.com" good to see
What do people use to run standalone jars on a unix platform and have that service restart if the platform is restarted?
We use systemd on all our services. We use spec files to create rpms for centos7 and one of the "%post" commands is systemctl enable /usr/lib/<some-application>/<some-application>.service
The service file itself has an ExecStart
command like java -jar /usr/lib/<some-application>...
and Restart
set to always
.
Same here too
Anyone got experience with lacinia subscriptions? Been tearing my hair out trying to work out how this is supposed to workβ¦
@dharrigan Iβve used systemd, and Iβve also known a few people to just use nohup <run jar> &
or run it inside screen