Reputation: 29
When I go to migrate material-ui from version 3.9.3 to version 4.3.2 in my React Application, I get an error like TypeError: styles_1.createGenerateClassName is not a function.
I'm completely confused on how to migrate to Material UI V4. What are the necessary packages I need with the correct version?
If any one has worked on this kind of scenario, please help me.
Thanks.
This is my package.json file:
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"@date-io/moment": "^1.3.1",
"@material-ui/core": "4.3.0",
"@material-ui/icons": "4.2.1",
"@material-ui/styles": "4.3.0",
}
Upvotes: 2
Views: 917
Reputation: 190
In v3, createGenerateClassName
came from @material-ui/core
:
import { createGenerateClassName } from '@material-ui/core/styles';
In v4, that comes from the dependency @material-ui/styles
:
import { createGenerateClassName } from '@material-ui/styles';
For further migration, see: https://material-ui.com/guides/migration-v3/
Upvotes: 3