tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

import ReactMDL from 'react-mdl'; not working #320

Closed achtan closed 8 years ago

achtan commented 8 years ago
import ReactMDL from 'react-mdl';

console.log(ReactMDL); // undefined

version 1.5.4

tleunen commented 8 years ago

Are you sure? I checked the build on npm and everything looks ok.

saravanan4514 commented 8 years ago

I'm getting the same issue as well. Kindly let me know if i have missed anything.

tleunen commented 8 years ago

Oh I think you're right. Only the specific components seem exported here https://github.com/tleunen/react-mdl/blob/master/src/index.js

saravanan4514 commented 8 years ago

Loading specific components we get an error "Cannot read property 'upgradeElement' of undefined". I tried using Button and checkbox component.

tleunen commented 8 years ago

Do you load the material.js file before using React-MDL? This is required to get the upgradeElement. Read: https://github.com/tleunen/react-mdl#requirements

I know this is not ideal and will be resolved in the next major version.

saravanan4514 commented 8 years ago

Thank you so much for your valuable response. Awaiting for the next major version.

tleunen commented 8 years ago

Btw, to resolve the undefined issue when using this import ReactMDL from 'react-mdl';

You can use this instead:

import * as ReactMDL from 'react-mdl';

But I highly suggest you to grab the specific components you want by using the direct path to the component react-mdl/lib/Button or using this syntax: import { Button } from 'react-mdl.