Update React to 0.14.3, and use react-dom-server

This commit is contained in:
Dan Holmsand 2015-11-20 18:57:00 +01:00
parent 5a5670b3fe
commit 443e7f45c5
3 changed files with 14 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{ {
"dependencies": { "dependencies": {
"react": "^0.14.0", "react": "^0.14.3",
"react-dom": "^0.14.0" "react-dom": "^0.14.3"
}, },
"scripts": { "scripts": {
"bundle": "webpack && NODE_ENV=production webpack -p" "bundle": "webpack && NODE_ENV=production webpack -p"

View File

@ -5,7 +5,8 @@
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.145"] [org.clojure/clojurescript "1.7.145"]
[cljsjs/react-dom "0.14.0-0"]] [cljsjs/react-dom "0.14.3-1"]
[cljsjs/react-dom-server "0.14.3-0"]]
:plugins [[lein-cljsbuild "1.1.0"] :plugins [[lein-cljsbuild "1.1.0"]
[codox "0.9.0"]] [codox "0.9.0"]]
@ -59,6 +60,7 @@
[{:file "target/webpack/bundle.js" [{:file "target/webpack/bundle.js"
:file-min "target/webpack/bundle.min.js" :file-min "target/webpack/bundle.min.js"
:provides ["cljsjs.react.dom" :provides ["cljsjs.react.dom"
"cljsjs.react.dom.server"
"cljsjs.react"]}]}}}}} "cljsjs.react"]}]}}}}}
:prod-test [:prod :test] :prod-test [:prod :test]

View File

@ -1,5 +1,5 @@
(ns reagent.dom.server (ns reagent.dom.server
(:require [cljsjs.react.dom] (:require [cljsjs.react.dom.server]
[reagent.impl.util :as util] [reagent.impl.util :as util]
[reagent.impl.template :as tmpl] [reagent.impl.template :as tmpl]
[reagent.interop :refer-macros [$ $!]])) [reagent.interop :refer-macros [$ $!]]))
@ -9,10 +9,14 @@
(defn- server [] (defn- server []
(if-some [r react-server] (if-some [r react-server]
r r
(set! react-server (do
(or (and (exists? js/require) (set! react-server
(js/require "react-dom/server")) (or (and (exists? js/ReactDOMServer)
util/react)))) js/ReactDOMServer)
(and (exists? js/require)
(js/require "react-dom/server"))))
(assert react-server "Could not find ReactDOMServer")
react-server)))
(defn render-to-string (defn render-to-string
"Turns a component into an HTML string." "Turns a component into an HTML string."