I'm trying to understand when we must deref a cursor to get its value.
In the om cursors wiki it states that
event handlers are considered not part of the render phase, and therefore cursors in handlers should be drefed.
Same is shown in the…
First of all, this https://github.com/taylorSando/om-material-ui doesn't work with latest React/Material UI.
The main reason, I think, is this warning in console:
Warning: Something is calling a React component directly. Use a factory or JSX…
I would like to write something like a clock app. The state is basically a number which is repeatedly incremented. One way of doing it can be seen here.
(ns chest-example.core
(:require [om.core :as om :include-macros true]
[om.dom :as…
Using Om, it seems like passing relevant parts of the app state to child components is effectively the same thing as not passing any app state but using ref-cursors. What is the use case for ref-cursors over passing pieces of the app state down the…
How can I convert this function (into Clojurescript) that takes a JavaScript object and pushes it's contents into an array.
function toKeyValueList(obj) {
var arr = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
arr.push({
…
I want to make a click handler function for an Om component. The docs and Stack Overflow examples I've found always declare anonymous functions like this
(defn main-view [_ owner]
(reify
om/IRender
(render [_]
(let [xs (items)]
…
I sometimes find it useful to use React's Refs in order to change the state of the DOM as for example to focus an input field after rendering a component. Does Reagent or Om implement this or if not what is the idiomatic way to do this in those…
I'm displaying a menu in Om, using a component and subcomponent like this:
(def app-state (atom {:location ""
:menuitems [["Pages" "/pages/"]
["Images" "/images/"]]}))
(defn menu-item-view…
I have an text input element that uses component state and application state.
In the example shown in React: More About Refs, the goal is to call focus on the element after re-rendering. Here is the key part, done with JS in…
I'm using Om for the client side and through the lifetime of the application many components gets mounted/unmounted. When mounted, various channels are opened (in go blocks). And I'm planning to use IWillUnmount to close them too. But first, my…
Is it possible to write a component that renders nothing, for example, if its cursor data is empty ?
I can not do
(defn count-or-nothing [list-cursor owner]
(reify
om/IRender
(render [_]
(if (not (empty? list-cursor))
…
I am attempting to learn Om, and have come across something I don't understand. I would expect this code
(defn search-page-view [app owner]
(reify
om/IRender
(render [_]
(dom/div #js {:id "search-block"}
"Test")
…
I stumbled upon the official Om example under "examples/mixins", there's a definition as this:
(def MyComponent (let [obj (om/specify-state-methods! (clj->js om/pure-methods))]
(aset obj "mixins" #js [TestMixin])
(js/React.createClass…
I need to display an input element with an initial value read from a cursor, but I don't need to update the cursor back when the user enters the new text. For example:
(defn my-comp [app owner]
(reify
om/IRender
(render [_]
(dom/div…