react 2020-05-16

@namenu has joined the channel

Someone brought this up on twitter (on the recoil.js thread): https://docs.thi.ng/umbrella/atom/

I’ve been wanting to check out this thing but I always thought it was about graphics etc.

@pesterhazy has joined the channel

I tried to reimplement use-interval but my version (which looks like an exact translation to me but there must be some difference) doesn't work, while the original does

Browsing on mobile so might miss something. Be careful in useEffect calls to explicitly return undefined.

JS implicitly returns undefined, which React interprets as “nothing to do on unmount”

@orestis that was it!!!!

Does set! Return the value passed in?

@orestis it does indeed

So your callback was called on unmount I guess.

Let me restate to see if I learned my lesson

If you’re interested in plain React I’d suggest browsing the source of hx and helix. They cover gotchas like this :)

If the fn passed to useEffect returns a value other than undefined, React interprets that in a special way

https://reactjs.org/docs/hooks-reference.html docs aren’t that clear but yes - if you return a function it will be the cleanup function.

If you return something that’s not a function React will complain

hm but it didn't complain

So it’s either undefined or a function

ahh because it happend to be the goddamned callback

You returned a callback,

what a footgun!

An hour lost to debugging but hopefully I'll learn my lesson

Will look into hx as well too!

Yeah it can be annoying.

I didn't want to start with a lib because I wanted to understand things from the ground up

Note that hx is abandoned and @lilactown is moved to helix these days. I haven’t used the latter which is why I link to hx

I'm looking into using http://recoiljs.org/ with cljs and was going to re-learn hooks to get started

Yeah it’s good to start at the basics.

@r0man has joined the channel

In this channel we’re mulling over state management stuff

Yeah it's the perennial topic

if you're interested in Recoil this new video (released just yesterday) is a great overview https://www.youtube.com/watch?v=_ISAA_Jt9kI

Yeah I need to finish the last five minutes there. If you go to the zulip mirror you’ll see our discussion here.

it's kind of like Reagent built on top of hooks

ah, which zulip is that?

I’m working on https://github.com/orestis/reseda to explore this topic

ahh sweet, I'm looking into that as well

Uh, the Clojurian zulip? There’s a slack mirror bot which archives messages here.

Note that it’s very much a wip.

ah, thanks, you mean you can look at the zulip to read logs of older messages in this channel?

👍 1

did y'all already discuss recoil?

I need to figure out how to make a lib that works both with stable and experimental React.

Let me see if there’s a url

I think the channel is named there “slack mirror” and there’s a stream called react which is this channel.

set the channel topic: "mulling over state management stuff"

❤️ 1

haha, looks like I'm late to the party 🙂

@pesterhazy the lib I’ve been working on, https://github.com/Lokeh/helix/, provides IME the bare minimum to do ergonomic React programming in CLJS

like orestis was saying :)

it provides as thin of a runtime on top of React as possible, with just a few macros to smooth out the interop with props and elements

it provides easy usage hooks out of the box, as well

@lilactown nice, thanks for the link

@mauricelecordier has joined the channel

@olivergeorge has joined the channel

@guessous_saad has joined the channel