Fork me on GitHub
#re-frame
<
2017-10-11
>
genRaiy01:10:25

hi folks, just starting to pick up re-frame/reagent and loving it so far

genRaiy01:10:39

I have been experimenting with the re-com reagent components and now I need a way to allow the user to upload a file and the components do not seem to support that option (input type="file")

genRaiy01:10:47

is that right?

genRaiy01:10:50

I will check into a mix and match approach

genRaiy02:10:25

thanks @lovuikeng I will have a look

genRaiy02:10:26

this is another approach I found

genRaiy02:10:50

neither are as elegant as the re-com options .... life is hard some days 😉

lovuikeng02:10:34

re-com is only for CSS, upload however is low-level IO which is mostly messy 🙂

lovuikeng02:10:36

yogthos makes Luminus, I'm sure you'll learn from there, @raymcdermott

Bravi10:10:19

what is the difference between these two?

(defn main-panel []
  (let [some-message (re-frame/subscribe [:message])]
    (fn []
      [:div @some-message])))
and
(defn main-panel []
  (let [some-message @(re-frame/subscribe [:message])]
    [:div some-message]))
so basically returning a function rather than hiccup straight away?

mikethompson10:10:26

Have a look through the Reagent tutorials at the bottom of this page: https://github.com/Day8/re-frame/wiki#reagent-tutorials

mikethompson10:10:23

@bravilogy ^^^^ But from a re-frame point of view those two are the same. But you really should read those tutorials.

Bravi10:10:45

yep, going through them now, thank you 🙂

Bravi10:10:55

got it. so in my case it doesn’t make much difference but if I had some initial setup (like an internal state for example), then the form-2 would make more sense so that I don’t do the initial setup over and over again on each re-render

lovuikeng11:10:18

@bravilogy "If you need to initialize something when the component is created, you use a Form-2 component", otherwise use Form-1 since you don't have any init data logic for it https://purelyfunctional.tv/guide/reagent/

djtango15:10:25

does anyone have any good reading for managing routing in a reagent/reframe app?

djtango15:10:44

Thinking of url/query-params management + push state + reframe db

lovuikeng15:10:54

@djtango here is one to go along with secretary using re-frame-template +routes http://www.multunus.com/blog/2016/02/noobs-walkthrough-re-frame-app/

Bravi18:10:37

the other day I saw that in re-frame you can chain subscriptions and I can’t find those docs explaining how to do it

Bravi18:10:51

can someone drop me a link please?

Bravi18:10:36

nvm, found it

Bravi22:10:03

Ok I’ve added some more functionality to this 😄 https://frequent-scarecrow.surge.sh/ here’s the codebase if anyone’s interested: https://github.com/bravilogy/colours-game-clojure

gdeer8123:10:15

my eyes 😱

gdeer8123:10:01

@bravilogy that's neat, I couldn't handle more than a minute of that ha