Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Global-exports to require React and support node modules #887

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependency information:
```clojure
(ns example
(:require [goog.dom :as gdom]
[react-dom :as react-dom]
[om.dom :as dom]
[om.next :as om :refer [defui]]))

Expand All @@ -49,7 +50,7 @@ dependency information:

(def hello (om/factory Hello))

(.render js/ReactDOM (hello) (gdom/getElement "example"))
(react-dom/render (hello) (gdom/getElement "example"))
```

## Tutorials
Expand Down
11 changes: 6 additions & 5 deletions build.boot
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
(set-env!
:source-paths #{"src/main"}
:dependencies '[[org.clojure/clojure "1.9.0-alpha16" :scope "provided"]
[org.clojure/clojurescript "1.9.542" :scope "provided"
[org.clojure/clojurescript "1.9.908" :scope "provided"
:classifier "aot"
:exclusions [org.clojure/clojure
org.clojure/data.json]]
[org.clojure/clojurescript "1.9.542" :scope "provided"
[org.clojure/clojurescript "1.9.908" :scope "provided"
:exclusions [org.clojure/clojure
org.clojure/data.json]]
[org.clojure/data.json "0.2.6" :scope "provided"
:classifier "aot"]
[cljsjs/react "15.5.4-0"]
[cljsjs/react-dom "15.5.4-0"]
[cljsjs/react "15.6.1-1"]
[cljsjs/react-dom "15.6.1-1"]
[cljsjs/react-dom-server "15.6.1-1"]
[com.cognitect/transit-clj "0.8.300"]
[com.cognitect/transit-cljs "0.8.239"]

Expand All @@ -20,7 +21,7 @@
[figwheel-sidecar "0.5.10" :scope "test"
:exclusions [org.clojure/clojurescript
org.clojure/tools.reader]]
[devcards "0.2.3" :scope "test"
[devcards "0.3.0-SNAPSHOT" :scope "test"
:exclusions [org.clojure/clojurescript]]
[com.cemerick/piggieback "0.2.1" :scope "test"
:exclusions [org.clojure/clojure
Expand Down
5 changes: 3 additions & 2 deletions examples/mixins/src/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns examples.mixins.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true])
[om.dom :as dom :include-macros true]
[react :as react])
(:import [goog.ui IdGenerator]))

(enable-console-print!)
Expand All @@ -13,7 +14,7 @@
(def MyComponent
(let [obj (om/specify-state-methods! (clj->js om/pure-methods))]
(aset obj "mixins" #js [TestMixin])
(js/React.createClass obj)))
(react/createClass obj)))

(om/root
(fn [app owner]
Expand Down
9 changes: 5 additions & 4 deletions examples/stateful/src/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns examples.stateful.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
[om.dom :as dom :include-macros true]
[react :as react]))

(defn counter-view [data owner]
(reify
Expand All @@ -18,7 +19,7 @@
(update-in x korks f)))

(def MyClass*
(js/React.createClass
(react/createClass
#js
{:getInitialState
(fn [] #js {:value {:count 0}})
Expand All @@ -34,6 +35,6 @@
(-transact! [m korks f _]
(.setState this #js {:value (applyf m korks f)})))))))}))

(def MyClass (js/React.createFactory MyClass*))
(def MyClass (react/createFactory MyClass*))

(js/React.renderComponent (MyClass.) (.getElementById js/document "app"))
(react/renderComponent (MyClass.) (.getElementById js/document "app"))
Loading