Fork me on GitHub
#shadow-cljs
<
2019-01-07
>
heefoo02:01:56

has any one tried shadow-cljs with the latest react alpha ?

heefoo02:01:50

i get a " Hooks can only be called inside the body of a function component." that is not uncommon

lilactown02:01:14

yes, I’m heavily using hooks with shadow-cljs

lilactown02:01:22

are you using reagent @heefoo, by chance?

heefoo02:01:50

in general yes

heefoo02:01:58

but i want to try it raw

lilactown02:01:40

reagent components under the hood actually get created as classes, even though in CLJS we pass them around as functions

lilactown02:01:56

Hooks don’t work in class components, only function components

heefoo02:01:44

tried to test something like that

lilactown02:01:14

you’re calling your component as a function

heefoo02:01:28

i tried without

lilactown02:01:31

you need to pass your component as an element to render

lilactown02:01:45

(.creatElement r example)

lilactown02:01:13

if you want a library that gives you similar ergonomics as reagent (with hiccup syntax etc.) but uses just React and Hooks, you can try my library: https://github.com/Lokeh/hx

heefoo02:01:30

i've seen the library

heefoo02:01:36

is it yours ?

heefoo02:01:29

ok it worked.

👍 5
heefoo02:01:43

I feel total noob 😕

lilactown02:01:24

there’s a lot that reagent and JSX paint over for us. I got tripped up by the same thing

heefoo02:01:10

both reagent and rum do their own scheduling

lilactown02:01:01

that’s correct. which means that when concurrent react becomes stable, they won’t yet be able to take advantage of all of it’s features

heefoo02:01:17

it seems like they should have their own virtual dom implemented instead of just using reacts

heefoo02:01:38

yes thats what i am thinking too

heefoo02:01:11

moreover although i hadn't used them yet

heefoo02:01:34

react hooks might be closer to reagent's style

lilactown02:01:36

there’s a lot of work just in React’s virtual dom diffing and component abstraction that they are reusing

heefoo02:01:14

sure but there are other lighter virtual dom sollutions

lilactown02:01:02

true. you also get the whole React ecosystem of libraries, components, etc. 🙂

lilactown02:01:15

that’s the biggest value to me personally. which is why I started building hx

heefoo02:01:37

well makes sense

heefoo02:01:05

i was thinking about that posibility too

heefoo02:01:21

but didnt pas the createElement thing

heefoo02:01:01

I will be more tempting to try your library if there where any hook related exampples

heefoo02:01:18

just letting you know

lilactown02:01:53

thanks for the feedback. I have another project that I whipped up as a POC right when hooks came out: https://github.com/Lokeh/hooks-demo

lilactown02:01:13

but it’s not using the hx.react.hooks namespace

heefoo02:01:45

i should have cloned that 😛

lilactown02:01:31

I’m kind of waiting for the official React support to land for hooks before doing an announcement to the community writ large

heefoo02:01:40

thanks i will just read your code

heefoo09:01:32

@U4YGF4NGM i took a look on your code

heefoo09:01:02

also in the hx library

heefoo09:01:34

I like the atomified type implementation

heefoo09:01:27

But i wanted to ask you why do you use the same refernce to <-deref. It seems to me someone is going to lose refernce if they deref from different components and one unmounts.

heefoo02:01:31

i know, i have took a look on reagents code

heefoo02:01:03

i didnt do anything like that

lilactown02:01:13

if you want a library that gives you similar ergonomics as reagent (with hiccup syntax etc.) but uses just React and Hooks, you can try my library: https://github.com/Lokeh/hx

tbrooke16:01:08

I am looking at styling for a new shadow-cljs project - and from my research it looks like material-ui and semantic might have trouble because they have extensive cljs components that might conflict with shadow-cljs — I have also looked briefly and garden and some other similar libraries - I do not have complex styling needs — Any suggestions of what woul djust work for a Reframe Shadow-cljs app — mainly browser

richiardiandrea16:01:01

We use semantic UI but it is completely outside the shadow pipeline. We build using gulp and node-sass in a Makefile

royalaid16:01:09

I am using Material-UI with Shadow to some success but inside a hobby project and it works super great. The project is moving towards a CSS-in-JS solution so you shouldn't have to worry about an additional style pipeline (https://material-ui.com/css-in-js/basics/). All that being said I haven't hit the edges of the library quite yet so you might want to kick the tires yourself first.

royalaid22:01:21

@thheller Hey I am running into issue with using reagent's with-let

royalaid22:01:39

It appears to have also been encounter by @mhuebert before as well

royalaid22:01:20

Specifically Cannot infer target type in expression (. c__36937__auto__ -ratomGeneration)

thheller23:01:19

well either need to run off :infer-externs or live with the warning

thheller23:01:22

or fix it in reagent 😉

😂 5