Questions tagged [reagent]

Reagent provides a minimalistic interface between ClojureScript and React.

It allows you to define efficient React components using nothing but plain ClojureScript functions and data, that describe your UI using a Hiccup-like syntax.

342 questions
8
votes
1 answer

Google Chart CLJS Clojure

I tried to adapt this example in Google Chart. To re-frame framework, reagent. I would like to create a real-time chart, based on subscriptions. I tested with a simple counter =+-1. I got error: Assert failed: Render must be a function, not…
RRR
  • 103
  • 1
  • 7
8
votes
3 answers

How to use `setTimeout` in ClojureScript?

I'm trying to make a sleep function in ClojureScript (w/ Reagent): (ns cljweb.webpage (:require [reagent.core :as reagent])) (def temp-atom (reagent/atom 0)) (defn sleep [msec] (js/setTimeout (fn []) msec)) (defn page [] [:div [:p…
Qwerp-Derp
  • 487
  • 7
  • 20
8
votes
1 answer

How do I handle input elements in Clojure Re-Frame?

I have a couple options, but both seem a bit laggy, and I'm thinking that there should be a better alternative. I just would like to be able to create forms, even dynamically create them (eg adding rows to a form from within my app), and have…
Josh.F
  • 3,666
  • 2
  • 27
  • 37
8
votes
1 answer

Why Radium doesn't work with Reagent (Clojurescript)?

I was trying to get working FormidableLabs/radium · GitHub with reagent-project/reagent · GitHub, but I've come to a dead end. I was able to get it working partially by "hacking" reagent function create-class like this (It's almost the same as…
ma2s
  • 1,312
  • 1
  • 11
  • 24
8
votes
1 answer

re-frame: Input :on-change reset! doesn't change input value

I'm playing around with the re-frame framework. In the code below, I am having trouble with updating the input value when the user types something in: (defn measurement-input [{:keys [amount unit path]}] (let [amt (atom amount)] (fn [] …
Kurt Mueller
  • 3,173
  • 2
  • 29
  • 50
8
votes
1 answer

How to use a ReactJS Component with Clojurescipt/Reagent

Is it possible to wrap ReactJS components for use with Reagent in Clojurescript? I have read that it is. Can someone provide me with a basic example? Thanks
ducky
  • 1,113
  • 1
  • 11
  • 23
8
votes
3 answers

Using react-router without JSX

I'm trying to find an example of using react-router through the javascript API but have been unable to find anything so far. My goal is to use react-router with reagent and clojurescript. So if anyone has gotten this working (even with Om), I'd…
erikcw
  • 10,787
  • 15
  • 58
  • 75
7
votes
2 answers

How do I make devCards work with re-frame?

Devcards aims to provide a visual REPL experience for ClojureScript. They offer support to Reagent and OM. How can I make devCards work with re-frame?
dilvan
  • 2,109
  • 2
  • 20
  • 32
7
votes
2 answers

ClojureScript Re-frame subscription dereferencing dilemma

What's the best of following approaches? Outer subscription, early deref (defn component [msg] [:p msg])) (let [msg (rf/subscribe [:msg])] [component @msg] Outer subscription, late deref (defn component [msg] [:p @msg])) (let [msg…
jsmesami
  • 128
  • 1
  • 6
7
votes
1 answer

How can I change CSS class name dynamically with reagent?

About reagent. I need to change some CSS class name dynamically. How should I do that? Sample code is here. (defn app [] (let [array [1, 2, 3]] (fn [] [:div (for [index array] ;; I wanna change this classname like…
mitsuruog
  • 1,259
  • 3
  • 12
  • 21
6
votes
1 answer

Reagent component doesn't update

The 'add' and 'remove' items of shoppinglist ratom updates the 'shopping-list' component, but the 'update' doesn't. I used cljs REPL for updating the shoppinglist ratom. add: shopping.app=> (swap! shoppinglist assoc 3 {:id 3, :name "Coke", :price…
tkircsi
  • 315
  • 3
  • 14
6
votes
2 answers

What is correct way to broadcast secretary URL parameters to reagent component

I'm building an app on top of re-frame default template. I have following secretary route: (defroute "/users/:id" [] (re-frame/dispatch [:set-active-panel :user-panel]) I want to access id parameter from URL in my reagent component. The only way…
Boris Zagoruiko
  • 12,705
  • 15
  • 47
  • 79
6
votes
3 answers

How to do modal dialogs with Om or Reagent (and Bootstrap)

I wonder how showing and hiding of a modal dialog should be implemented with Om or Reagent. Since my UI is a function on the state, the show/hide should be triggered by a property in this state. But frameworks like Bootstrap require to call some…
Witek
  • 6,160
  • 7
  • 43
  • 63
6
votes
1 answer

on-click handler for a list item reagent clojurescript

I want to add a on-click handler for each item in my list. (defonce selected-department (atom "department!")) (defn sidebar [] [:div#sidebar-wrapper [:ul.sidebar-nav [:li.sidebar-brand [:a {:href "#"} "Departments"]] ;;[:li [:a…
5
votes
2 answers

Reagent configuration for multi-page applications

My project.clj has, :cljsbuild {:builds {:app {:source-paths ["src/cljs" "src/cljc"] :compiler {:output-to "target/cljsbuild/public/js/app.js" :output-dir…
Adeel Ansari
  • 39,541
  • 12
  • 93
  • 133
1
2
3
22 23