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
5
votes
1 answer

How to dispatch an event from an event in re-frame

I followed this example: https://github.com/Day8/re-frame/blob/master/docs/FAQs/PollADatabaseEvery60.md And here is my interval handler (defonce interval-handler (fn [{:keys [action id frequency event]}] (let [live-intervals (atom {})] …
5
votes
1 answer

Correctly manipulating state in reagent

I just learn Reagent in Clojurescript, I am just following some tutorial but maybe I miss something I have this code for the state (defonce app-state (atom {:text "Hello Chestnut!" :click-count 0})) and the rendered view (defn article [] [:div …
Ampersanda
  • 2,016
  • 3
  • 21
  • 36
5
votes
1 answer

How to prevent HTML escaping in Clojure Reagent (Hiccup like)

I am using ClojureScript Reagent. Which provides hiccup-like HTML generation. I have a String with HTML: (def code "hello world") When passed to Hiccup it will be escaped and I get no bold text on my page: [:div code] How to pass code to my…
Witek
  • 6,160
  • 7
  • 43
  • 63
5
votes
3 answers

Garden Generated Inline-styles in Reagent's Hiccup

In reagent, one can specify inline CSS styles like this: [:div {:style {:border "1px solid red"}} "My Text"] garden can make such CSS properties containing several values in a list more generic. Vectors for comma separated lists and nested vectors…
Anton Harald
  • 5,772
  • 4
  • 27
  • 61
5
votes
2 answers

How to prepare a React.js component for usage in ClojureScript as an external Reagent component?

I would like to use this React.js component as a foreign Reagent component in a ClojureScript application : https://github.com/felixrieseberg/React-Spreadsheet-Component. This component is however not available in the…
nilo de roock
  • 4,077
  • 4
  • 34
  • 62
5
votes
2 answers

using React components in Reagent

I am trying to use components from http://react-components.com (eg. react-youtube) in Reagent based application, but probably my naive approach is not the right one. I tried to install NPM packages with lein-npm module, include script in html page…
Jan Hamrský
  • 150
  • 1
  • 7
5
votes
2 answers

Reagent: How to get new props from component-will-receive-props?

So signature for component-will-receive-props is such: https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L114 :component-will-receive-props (fn [this new-argv]) But new-args seems like it's function or js object. I was…
ma2s
  • 1,312
  • 1
  • 11
  • 24
5
votes
2 answers

Looping Table Body With Two Rows in Clojurescript / Reagent

I'm having trouble getting my table body to line up properly using clojurescript / reagent. I'm actually not sure if this is me not understanding what to do in html or what... Currently I display the table body using a loop (defn table-body…
user3404870
5
votes
1 answer

How can I parse string into Hiccup?

How can I parse a string of Hiccup into a Hiccup node? For example, "[:b 'hello world']" into [:b "hello world"]
hzhu
  • 3,759
  • 5
  • 29
  • 39
5
votes
2 answers

How to attach Bootstrap tooltip to Clojurescript Reagent component

Here's a component I'm rendering at the end of each row of a table. The tooltip portion is not working. How can I attach Bootstrap tooltips to each component after it renders? (defn edit-button-component [] (fn [attrs] …
jmckitrick
  • 171
  • 6
5
votes
0 answers

Reagent should-component-update not called

I'm trying to implement the should-component-update lifecycle function in order to avoid some unnecessary rendering. My current implementation looks like this: (def my-component (with-meta (fn [props] …
kliron
  • 4,383
  • 4
  • 31
  • 47
4
votes
2 answers

Integrating Google's with React/Reagent

Google's provides all the key features I need without having write a custom solution via something like react-three-fiber or directly in three.js. I am struggling with how to properly integrate it into a Reagent (and React for that…
BorisKourt
  • 187
  • 2
  • 15
4
votes
2 answers

How to decode, and then format, tagged LocalDateTime value

This is my Clojurescript function, (defn message-list [messages] (println messages) ;; stmt#1 [:ul.messages (for [{:keys [timestamp message name]} @messages] ^{:key timestamp} [:li [:time (.toLocaleString timestamp)] ;;…
Adeel Ansari
  • 39,541
  • 12
  • 93
  • 133
4
votes
1 answer

How to import css from node module in Reagent

I just tried to create a project in clojurescript, that uses react-table. I import react-table like that (:require [react-table :as rt :default ReactTable]) Obviously, this isn't imported CSS from react-table. In javascript+React it would be…
4
votes
1 answer

Getting error Uncaught Error: Assert failed: Reaction is read only; on-set is not allowed

I am new to clojure and reagent. I was trying to generate dynamic number of checkboxes, the state of which is stored in the app state which is a list of dicts like this [{:checked false, :text "Sample text 1"} {:checked false, :text "Sample text…
1 2
3
22 23