Skip to content

How to use with reagent? #40

Closed
Closed
@cjohansen

Description

@cjohansen

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:

  • "Failed prop type: Invalid prop children of type object supplied to MuiThemeProvider, expected a single ReactElement"
  • "react-dom.inc.js:18118 Uncaught Error: MuiThemeProvider.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object"

Am I holding it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions