From 443e7f45c514172029314e4deb61dc6bb02510bb Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Fri, 20 Nov 2015 18:57:00 +0100 Subject: [PATCH] Update React to 0.14.3, and use react-dom-server --- package.json | 4 ++-- project.clj | 4 +++- src/reagent/dom/server.cljs | 14 +++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8a353cf..891a00a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { - "react": "^0.14.0", - "react-dom": "^0.14.0" + "react": "^0.14.3", + "react-dom": "^0.14.3" }, "scripts": { "bundle": "webpack && NODE_ENV=production webpack -p" diff --git a/project.clj b/project.clj index 0e079dd..6945240 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,8 @@ :dependencies [[org.clojure/clojure "1.7.0"] [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"] [codox "0.9.0"]] @@ -59,6 +60,7 @@ [{:file "target/webpack/bundle.js" :file-min "target/webpack/bundle.min.js" :provides ["cljsjs.react.dom" + "cljsjs.react.dom.server" "cljsjs.react"]}]}}}}} :prod-test [:prod :test] diff --git a/src/reagent/dom/server.cljs b/src/reagent/dom/server.cljs index 5147fdc..783872d 100644 --- a/src/reagent/dom/server.cljs +++ b/src/reagent/dom/server.cljs @@ -1,5 +1,5 @@ (ns reagent.dom.server - (:require [cljsjs.react.dom] + (:require [cljsjs.react.dom.server] [reagent.impl.util :as util] [reagent.impl.template :as tmpl] [reagent.interop :refer-macros [$ $!]])) @@ -9,10 +9,14 @@ (defn- server [] (if-some [r react-server] r - (set! react-server - (or (and (exists? js/require) - (js/require "react-dom/server")) - util/react)))) + (do + (set! react-server + (or (and (exists? js/ReactDOMServer) + js/ReactDOMServer) + (and (exists? js/require) + (js/require "react-dom/server")))) + (assert react-server "Could not find ReactDOMServer") + react-server))) (defn render-to-string "Turns a component into an HTML string."