This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-01
Channels
- # aleph (1)
- # bangalore-clj (5)
- # beginners (24)
- # boot (113)
- # cider (42)
- # cljs-dev (2)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (37)
- # clojure-austin (4)
- # clojure-brasil (3)
- # clojure-france (55)
- # clojure-greece (15)
- # clojure-ireland (4)
- # clojure-italy (13)
- # clojure-russia (37)
- # clojure-spec (50)
- # clojure-uk (31)
- # clojurescript (49)
- # component (12)
- # consulting (1)
- # cursive (6)
- # datascript (9)
- # datomic (27)
- # editors (2)
- # garden (1)
- # hoplon (18)
- # jobs (1)
- # klipse (25)
- # lein-figwheel (1)
- # leiningen (1)
- # luminus (2)
- # om (53)
- # om-next (8)
- # onyx (5)
- # parinfer (4)
- # perun (4)
- # re-frame (13)
- # remote-jobs (1)
- # ring (1)
- # ring-swagger (3)
- # rum (52)
- # spacemacs (36)
- # specter (13)
- # sql (3)
- # untangled (49)
- # vim (11)
- # yada (9)
@martinklepsch Ah so is the magic the use of ^:dynamic
? I’m still new to Clojure so I just came across that.
@jupl basically, yes. Since component context is a React thing and we don't run React on the server we want a similar construct. Clojure's dynamic vars provide that kind of feature. I think usually it is advised to use it as little as possible but in this case I believe it is the right choice.
@martinklepsch Yeah I totally agree. Thanks!
Hi everyone, is there a way to to export a rum export for use in a large react application? For example:
(def ^:export rumComp (rum/defc hello-world [] [:h1 (:text "hello world”)]))
could I then use <rumComp />
in plain React?
so looking at here: https://facebook.github.io/react/docs/react-api.html#createfactory, you’re suggesting maybe try a using React.createFactory(type)
?
and for the work, datascript and rum are why I keep trying to get clojurescript in at at work
if you need class, something like that should work: (def ^:export rumCompClass (:rum/class (meta rumComp))
hmm am I missing something, if look at the rumCompExp
fn and try to run it I get … not a function
. In devtools it says its a cljs.core.MetaFn
ok so given this:
(def ^:export rumComp (rum/defc hello-world []
[:h1 (:text "hello world")]))
(defn ^:export rumCompExp [] (rumComp))
just
(rum/defc hello-world []
[:h1 (:text "hello world")]))
(defn ^:export rumCompExp [] (hello-world))
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
const rumCompExp = window.rum_test.core.rumCompExp;
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
{rumCompExp()}
</div>
);
}
}
export default App;