madvas / cljs-react-material-ui

Clojurescript library for using material-ui.com
Eclipse Public License 1.0
205 stars 32 forks source link

How to use with reagent? #40

Closed cjohansen closed 6 years ago

cjohansen commented 6 years ago

I tried using this with reagent with little luck. The following works as expected:

(ns myapp.core
  (:require [cljsjs.material-ui]
            [cljs-react-material-ui.core :as ui]
            [cljs-react-material-ui.icons :as ic]
            [reagent.core :as r]))

(defn component []
  (ui/mui-theme-provider
   {:mui-theme (ui/get-mui-theme)}
   (ui/paper "Hello world")))

(r/render (component) (js/document.getElementById "app"))

But this fails spectacularly:

(ns myapp.core
  (:require [cljsjs.material-ui]
            [cljs-react-material-ui.core :as ui]
            [cljs-react-material-ui.icons :as ic]
            [reagent.core :as r]))

(defn component []
  [ui/mui-theme-provider
   {:mui-theme (ui/get-mui-theme)}
   [ui/paper "Hello world"]])

(r/render (component) (js/document.getElementById "app"))

Tested with cljs-react-material-ui 0.2.48 and React 15.6.1-1 and 16.0.0-beta.5-1. In both cases I get a bunch of exceptions:

Am I holding it wrong?

njordhov commented 6 years ago

Use cljs-react-material-ui.reagent/mui-theme-provider instead of cljs-react-material-ui.core/mui-theme-provider.

njordhov commented 6 years ago

Looks like the fix is in with PR #38.

cjohansen commented 6 years ago

D'OH! That was lazy of me. Thanks!