This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-04
Channels
- # adventofcode (171)
- # beginners (160)
- # boot (13)
- # chestnut (2)
- # cider (6)
- # cljs-dev (15)
- # cljsjs (35)
- # cljsrn (1)
- # clojure (139)
- # clojure-argentina (3)
- # clojure-brasil (1)
- # clojure-greece (31)
- # clojure-italy (5)
- # clojure-russia (5)
- # clojure-spec (18)
- # clojure-uk (11)
- # clojurescript (42)
- # clojurex (6)
- # core-async (12)
- # cursive (14)
- # dirac (13)
- # emacs (13)
- # events (1)
- # fulcro (46)
- # graphql (7)
- # leiningen (10)
- # lumo (3)
- # mount (31)
- # off-topic (20)
- # onyx (30)
- # perun (4)
- # planck (47)
- # re-frame (28)
- # reagent (14)
- # ring (5)
- # shadow-cljs (3)
- # spacemacs (7)
- # specter (13)
- # timbre (3)
- # unrepl (65)
- # yada (8)
(defn pulsing-text [message]
(fn [message]
(let [this (atom nil)]
(r/create-class
{ :display-name "pulsing-text"
:component-did-update
#(ocall @this :bounce 800)
:reagent-render
(fn []
[animatable/text {:ref #(reset! this %)
:style {:font-size 16
:text-align :center
:color theme/alternate-text-color}}
message])}))))
A new snapshot version of re-frame-trace is out, it has a pretty cool snapshotting feature. It lets you take a snapshot of app-db and then reset to it later on. Just add [day8.re-frame/trace "0.1.14-20171204.040033-2"]
. One thing to note, snapshots are only saved for that browser session, they're not saved to localstorage (because serialisation can be messy)
This is stuff that Iāve been imagining since I first learnt about reagent. Is it present in other libs?
Hello ! I'm trying to get a very simplified version of the todomvc example. I have the following default db, sub and view for my tasks list :
But I get this error : Uncaught Error: [object Object] is not ISeqable at Object.cljs$core$seq [as seq]
Any idea why?
Ah, sorry, opening in new windows helps, but expanding it inline for some reason does not.
@ganlhi you need to dereference the subscription
a.g. (for [todo @todos] ...)
instead of (for [todo todos] ...)
in the error Uncaught Error: [object Object] is not ISeqable at Object.cljs$core$seq
[as seq] - the for is trying to open a seq over the subscription's reaction object, but it can't
oh OK !
indeed it works much better š
thanks
Has anyone solved making deep links work with re-frame with the criteria that we need to check for the presence of a cookie in order to display certain routes
Rookie question: Iāve imported react-native-maps component like this .
(def map-view (r/adapt-react-class (js/require "react-native-maps")))
(defn my-map [coords markers]
[map-view {:style {:flex 1}
:initialRegion coords}])
Now I need to create a a Marker on the Map. Itās supposed to be a nested component āMapView.Markerā. How do I create the marker? In ānormal Reactā it happens like this
<MapView
region={this.state.region}
onRegionChange={this.onRegionChange}
>
{this.state.markers.map(marker => (
<MapView.Marker
coordinate={marker.latlng}
title={marker.title}
description={marker.description}
/>
))}
</MapView>
How should do I refer to āMapView.Markerā?
It should happen maybe something like this:
(defn my-map [coords markers]
[map-view {:style {:flex 1}
:initialRegion coords}
[map-view/Marker {:blabablab 1231}]
])
But whatās the correct syntax for map-view/Marker?@valtteri I believe
;; add `(:require [goog.object :as gobj])`
(def react-map-view (js/require "react-native-maps"))
(def map-view (r/adapt-react-class react-map-view))
(def map-viewer-marker (r/adapt-react-class (gobj/get react-map-view "Marker")))
whatās a reasonable way to (using secretary routes and re-frame) to restrict routes based on some value in the app-db?
my current approach is to dispatch event from the secretary route, check my condition in the event subscriber/handler, and dispatch another event resetting the current page if the condition isnāt met
Hey guys, I find re-frame absolutely amazing and I personally use any chance I get. However, due to some external circumstances I might find myself in Javascript land soon. I was wondering. If I had to stick completely to Javascript, what would I use to emulate the re-frame framework the best? Iām looking at React+Redux but I was wondering if there was anything better?
@kasuko I most often hear redux compared with re-frame. I imagine there are a bunch of redux variants, but it seems like a reasonable choice
@kasuko You might give MobX a look. Here is one write-up comparing that and Redux: https://www.robinwieruch.de/redux-mobx-confusion/
Hi, iām implementing a quick drag/drop implementation with re-frame. So far, everything is working pretty good. I have event handlers in my ādraggableā that set the item being dragged in the app-db,etc. This works fine. Similarly, iāve on-dragover, etc handlers that change some local state in the drop-target component to highlight the drop-target, etc etc. This all works fine. What, im trying to do now, is basically have any drop target on the screen change some state when the ādraggableā on-drag fires and I set my dragging state in the app-db. I have subscription on the drop-target component that looks at the dragging state. The issue is that itās not reflecting the state of the app-db until after I stop dragging. Hereās a snippet of the drop-target code:
(defn field-drop-target
[prev-field-id group-id]
(let [dragged (rf/subscribe [:dragged])
is-dragging? (some? @dragged)
width (r/atom "10px")
background-color (r/atom "white")
border (r/atom "none")
showtarget (fn [] (do
(reset! width "100px")
(reset! background-color "lightgrey")
(reset! border "1px dashed black")))
hidetarget (fn [] (do
(reset! width "20px")
(reset! background-color "white")
(reset! border "none")))
curpageid (rf/subscribe [:cur-page-id])]
(fn [prev-field-id group-id]
is-dragging?
doesnāt become true, until after I drop or stop dragging. Even though itās set in the db. I figure this has something to do with the event loop, etc, but Iām just not sure how to get around it..