Fork me on GitHub
#reagent
<
2020-05-07
>
David Pham05:05:45

The new :f> seems great!

David Pham05:05:30

I wonder how it will interact with re-frame.

juhoteperi05:05:34

@neo2551 Shouldn't affect re-frame use in any way. Ratoms work the same in function components.

mikethompson05:05:36

Yeah, the question should perhaps be more "how will the use of React Hooks interact with re-frame"

mikethompson05:05:03

Because Hooks offers a different "state management" model

juhoteperi05:05:27

Yeah. But my view is still that ratoms are already more useful, they can be used outside render call etc.

mikethompson05:05:51

Yes, I absolutely agree

mikethompson05:05:06

I was just suggesting the that issues would be elsewhere

mikethompson05:05:00

Ie. :f> will work fine with re-frame. But the Hooks within them might not

juhoteperi05:05:13

But hooks could be useful as implementation for some things. Like useRef could be used to initialize ratoms/subscription once (like subscription deref already works).

mikethompson05:05:40

Yep, I'm probably thinking more of useState etc

mikethompson05:05:48

Is that the name?

juhoteperi05:05:35

With useRef you can create mutable object, per component instance, where changes don't automatically trigger re-render.

mikethompson05:05:00

I'm going to look that up now

mikethompson05:05:12

I'm trying to get up the Hooks learning curve

juhoteperi05:05:27

Just learned about that use for useRef yesterday myself, @roman01la recommended it for function component implementation instead of useState where I just had one value I didn't update: https://github.com/reagent-project/reagent/commit/8b365c11dd0cc1e18c9d06a10e0d6d726721e50a

David Pham05:05:10

@mikethompson thanks for clarifying my thoughts. It is exactly what I was thinking, hooks provide an additional way of managing state and I wondered whether/how we will manage it with re-frame or otherwise

mikethompson05:05:19

I strongly suspect that Hooks managing state won't work well with re-frame managing state

mikethompson05:05:20

I'm trying to like Hooks, i really am :-) But I don't like my views doing anything other than rendering

juhoteperi05:05:15

useState could be used for local state, similar to local atom for some parts, probably doesn't make sense to use them for application state. And for interop etc.

👍 4
mikethompson05:05:04

I haven't tested it yet: but can we useState with a CLJS value?

lilactown14:05:33

You can place any value inside of a useState or useRef, no need to convert anything

mikethompson05:05:48

Or will it get round-tripped via clj->js

juhoteperi05:05:07

Should work. I think hx and other wrappers use cljs values with state hooks directly.

mikethompson06:05:47

@juhoteperi BTW, I'm currently putting together a grownups website for re-frame. When we have it all figured out, maybe we do something similar for Reagent

juhoteperi06:05:39

Yeah I've been thinking about building a new website, and pretty much rewriting all the docs also.

David Pham06:05:26

I thought all your docs were really good for both projects.

juhoteperi06:05:23

I think Reagent docs at least has good parts, but some of the older pages could be reordered a bit and they are missing some stuff and adding them requires modifying the existing parts.

mikethompson08:05:30

@neo2551 It is not the contents of the docs that's an issue. Its the presentation.

David Pham08:05:10

I wrote a small library for myself that extends marginalia for leveraging mkdocs-material (https://davidpham87.github.io/materiala/)

David Pham08:05:45

I think http://calva.io also use it. I found it was nice enough with the search function as well.

mikethompson08:05:47

@neo2551 yeah, we're going with mkdocs

🎉 8
bitkiller.4209:05:42

Shared from shadow-cljs channel … perhaps it’s more a reagent topic.