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

component design in react, where to put the 'full height'?

After using react (actually the ClojureScript wrapper reagent) for a while now, I'm still not sure what's the best way to solve the following problem: Say you'd have a Root component: class Root extends React.Component { render() { return ( …
Anton Harald
  • 5,772
  • 4
  • 27
  • 61
0
votes
1 answer

Reagent :component-did-mount hook not called with meta-annotated component function

strangely my component-lifecycle functions are not called when I define a component as a function with the hooks as meta-data (the example is as easy as that - like in the examples I saw around). (defn my-callback [this] (println (.-innerHTML…
fricke
  • 1,330
  • 1
  • 11
  • 21
0
votes
1 answer

Reagent state not updating after setInterval

I have this reagent component that uses setInterval to change its state: (defn foo [] (let [value (atom 1)] (js/setInterval (fn [] (reset! value (rand-int 100)) (println @value)) 1000) (fn [] [:p @value]))) I can see the value being…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
0
votes
1 answer

Reagent ClojureScript

I am working on a Reagent project, and seem to not be able to use a macros.clj file. No matter where I put it, it keeps giving me the same message: "could not locate macros/core__init.class or macros/core.clj on classpath. Where should I be putting…
nick huber
  • 11
  • 1
0
votes
1 answer

Let Sub Component React on Parent's State Plus Having its Own State

Consider the following Reagent components: (defn sub-compo [n] (let [state (r/atom {:colors (cycle [:red :green])})] (fn [] [:div {:style {:color (-> @state :colors first)} :on-mouse-move #(swap! state update :colors rest)} …
Anton Harald
  • 5,772
  • 4
  • 27
  • 61
0
votes
1 answer

Reagent doesn't re-render on first transition of ratom

I've been working on a linked text-box and list-component, similar to a combobox or typeahead component. I want to be able type free text into the text-box, unless an item from the list is clicked, in which case overwrite the text-box with the…
user36015
  • 23
  • 5
0
votes
1 answer

Why is it not possible to define the state of a reagent component in a let?

Say that we have a text text area defined in hiccup syntax. (def written-text (reagent/atom "")) (defn text-area [] [:textarea {:value @written-text :on-change #(reset! written-text (-> % .-target .-value)) :on-click …
Rovanion
  • 4,382
  • 3
  • 29
  • 49
0
votes
1 answer

Local reagent atom won't update when global ratom change

Let's say I have a component defined like this: (defn test-comp [timespan-ratom] (let [[timespan-lower timespan-upper] @timespan-ratom] (fn [] [:div.row (str "Testing" timespan-lower timespan-upper)]))) timespan-ratom is defined…
Johan
  • 37,479
  • 32
  • 149
  • 237
0
votes
2 answers

How to transfer ratom from browser to REPL via ClojureScript?

I have just started to develop apps in ClojureScript and I'm using Figwheel with Reagent and LightTable. Everything seems to be super interactive, I really love the idea of REPL and code reload but I cannot figure out how is it possible to transfer…
0
votes
3 answers

Clojure list comprehension and unique values for reagent

Let's assume that we have this grid with values that can be 0 or 1: (def grid [[1 0 1] [1 0 0] [1 0 1]]) Now I want to transform grid into an html Hiccup like format using list comprehension: (defn cell-component [is-it-1…
Michel Uncini
  • 321
  • 1
  • 14
0
votes
1 answer

ClojureScript use .requestFullscreen on a video

How can I .requestFullscreen (or .-volume) on a video from another element ? I've tried using this-as macro and getElementByID but my editor and Figwheel are unhappy when I try to make this function call.
txesc
  • 21
  • 3
0
votes
1 answer

boot-clj clojurescript project w/ reagent and react-with-addons?

Is anyone familiar with using boot-clj and cljsjs to package react-with-addons inside a reagent project? Reagent already requires react, so you have to explicitly list exclusions as noted here. Despite doing this, the build process is always…
Clev3r
  • 1,568
  • 1
  • 15
  • 28
0
votes
1 answer

Adding Google Maps to Luminus Reagent page?

I'd like to add a page containing a google maps component to my Luminus application but I can't figure out how to do this. I've tried to follow the Reagent google maps guide but the map won't show. This is the Clojurescript code that I've tried: (ns…
Johan
  • 37,479
  • 32
  • 149
  • 237
0
votes
1 answer

Ratom specified in component can't update that component?

Just starting out with Reagent. I have a button whose :on-click value causes a CPU-intensive function to run; it takes a long time to return. I want to update the text of the button itself to notify the user that one might have to wait, so I…
Mars
  • 8,689
  • 2
  • 42
  • 70
0
votes
1 answer

Reagent on creating element with infinite seq as args

Based on this on More equality section, is it still possible to create a component which accepts an infinite seq as args? (defn my-div [& args] (let [[params args] (if (-> args first map?) [(first args) (next args)] …
tsukihi
  • 53
  • 3
1 2 3
22
23