Fork me on GitHub
#reagent
<
2019-08-16
>
emccue02:08:17

@jo.chasinga to give you your first hint, i remember that to use a react component you can use [:> ReactComp {...props...} ...children...]

Joe Chasinga02:08:42

Thank you! Can you please expand on that a little?

Joe Chasinga02:08:26

Do you remember how to import that reagent component from a jsx module?

emccue12:08:33

no its been more than 2 years since i tried too.

emccue12:08:45

you should ask in #shadow-cljs

tianshu14:08:50

Hmmm, I have a question about SPA, not specific for reagent. On mobile safari, user can use swipe gesture to forward/back. that make my page flicker, how can I avoid this?

ivangalbans18:08:58

i wanna use the react component react-sidebar. My problem is that the styles are passed to props as an object (https://github.com/balloob/react-sidebar#styles). it's possible to do this in reagent ?

ivangalbans19:08:42

React:

styles={{ sidebar: { background: "white" } }}

colinkahn19:08:04

A sort of unusual question: is there a way to update a reagent atom within a component without triggering a re-render?

colinkahn19:08:02

For anyone interested you can do:

(binding [reagent.ratom/*ratom-context* nil]
  ;; Deref here
)

dpsutton20:08:50

Just for my own understanding what’s your use case?

colinkahn20:08:41

@dpsutton I solved it (see my thread comment) but my use case was some interop w/ an existing reagent library where I was creating a one-off instance of something that validated but stored in an ratom, which caused a loop when I would call my fn inside of render

lilactown20:08:17

why store it in a ratom then?

lilactown20:08:39

your threaded solution is not something I think reagent would support long term

lilactown20:08:01

the whole ratom machinery is a black box and the *ratom-context* is def an implementation detail

lilactown20:08:21

it sounds like you should store it in a regular atom

dpsutton20:08:18

Yeah that’s what I was wondering: why a ratom at all

colinkahn20:08:38

I’m not storing it, the library i’m using is doing it that way

whoops22:08:29

@ivangalbans When using adapt-react-class the first argument is the props. See: https://reagent-project.github.io/docs/master/InteropWithReact.html

👀 4
ivangalbans15:08:34

@UM9SV1LE8 yes, you are right. But I am asking for the particular props styles. I don't see any examples of this. The problem is how you pass custom styles to the props. In react you can do:

styles={{ sidebar: { background: "white" } }}
But in reagent you expect to do:
{
  :styles {:sidebar {:background "white"}}
}
I don't know, something like this I explained well my problem now ?

whoops16:08:48

I'm pretty you should just be able to use your expected example, with the one caveat that you'd need to convert it to a javascript object first via clj->js.

ivangalbans18:08:39

yep, I forgot clj->js facepalm