Fork me on GitHub
#clojurescript
<
2019-04-20
>
d00:04:19

is there anything like react proptypes for re-frame/reagent?

dnolen00:04:54

no but you do have spec

d01:04:20

do you have any example on using it with reframe components?

dnolen01:04:56

it just works w/ functions

dnolen01:04:05

re-frame components & reagent components are just functions

d01:04:51

makes sense

d01:04:52

thanks 🙂

dnolen01:04:24

just look at how to spec functions - it will just work

metehan14:04:32

`(ns threedays.components.pcard
  (:require [reagent.core :as r]))

(def locals (r/atom {}))

(defn localnews [] (swap! locals update :metehan "XXX"))

metehan14:04:48

when i call localnews it says

metehan14:04:03

Uncaught TypeError: f.call is not a function
    at core.cljs:5331
    at Function.cljs$core$IFn$_invoke$arity$3 (core.cljs:5331)

Mno15:04:22

I believe update requires that you pass it a function

naomarik15:04:33

@m373h4n use assoc not update

Mno15:04:05

if you’re looking to add/modify a key-value pair use assoc like naomarik says.

metehan15:04:16

ah thanks it worked. the tutorial I follow instructor guy used update and it worked. that's why i was surprised. is it because some version difference or I did something wrong?

Mno15:04:52

so update you have to pass it a function that it’ll run on the value of a specific key (such as (update {:a 1} :a inc) ). I don’t think thats changed at all.

Mno15:04:27

but I’m not totally certain.

metehan15:04:14

i see the difference now. yes he used "inc" I just misunderstood how swap! works. thank you for making this clear for me 🙂

borkdude20:04:55

When linting omcljs/om using a classpath produces by lein classpath I got some weirdness. Turned out I was linting multiple versions of the same namespace. That was caused because devcards brings in another older version of om:

[devcards "0.2.4" :scope "test" :exclusions [[org.clojure/clojurescript]]]
   [cljsjs/showdown "1.4.2-0" :scope "test"]
   [sablono "0.8.1" :scope "test"]
     [org.omcljs/om "1.0.0-alpha48" :scope "test"]
Maybe that should be excluded from the classpath in the project.clj?

borkdude20:04:15

This probably doesn’t ever give an error, because the local files take priority I assume

borkdude20:04:38

but still it could give unexpected results during development when you e.g. require a namespace that should not exist anymore