Material-ui: [Example] createGenerateClassName is not a function in nextjs example

Created on 22 Dec 2017  路  4Comments  路  Source: mui-org/material-ui


When I run example in nextjs. Do yarn and yarn dev to run the demo application. Hit to http://localhost:3000 then it throw the error is not a function

  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior


Can call the createGenerateClasName as usually

Current Behavior


Error throwed:

TypeError: (0 , _styles.createGenerateClassName) is not a function
    at createContext (/Users/nampdn/Projects/wfc/@example/nextjs/styles/getContext.js:20:3)
    at getContext (/Users/nampdn/Projects/wfc/@example/nextjs/styles/getContext.js:35:5)
    at Function.MyDocument.getInitialProps (/Users/nampdn/Projects/wfc/@example/nextjs/pages/_document.js:61:3)
    at _callee$ (/Users/nampdn/Projects/wfc/@example/nextjs/node_modules/next/dist/lib/utils.js:36:30)
    at tryCatch (/Users/nampdn/Projects/wfc/@example/nextjs/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/nampdn/Projects/wfc/@example/nextjs/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/nampdn/Projects/wfc/@example/nextjs/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/nampdn/Projects/wfc/@example/nextjs/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/nampdn/Projects/wfc/@example/nextjs/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at new Promise (<anonymous>)

Steps to Reproduce (for bugs)

  1. curl https://codeload.github.com/mui-org/material-ui/tar.gz/v1-beta | tar -xz --strip=2 material-ui-1-beta/examples/nextjs
  2. cd nextjs
  3. yarn
  4. yarn dev
  5. Open browser: http://localhost:3000

Context

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI |1.0.0-beta.24 |
| React |16.2|
| browser | Chrome |
| OS | MacOS |

All 4 comments

use this.
import createGenerateClassName from 'material-ui/styles/createGenerateClassName';

Thanks @jhbae200, I can get it to work now, brilliant!

It will be fixed with the next beta release.

Released.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pola88 picture pola88  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments

reflog picture reflog  路  3Comments

ghost picture ghost  路  3Comments

iamzhouyi picture iamzhouyi  路  3Comments