question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

makeStyles theme.spacing does not work on mui/material: 5.2.7 but works on 5.2.2

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

I upgrade from @mui/material 5.2.2 to @mui/material 5.2.7 and suddenly I get

TypeError: theme.spacing is not a function
  35 |   },
  36 |   menuButton: {
> 37 |     marginRight: theme.spacing(2),
     |                       ^
  38 |   },
  39 |   title: {
  40 |     marginRight: 26,

Expected behavior 🤔

I expected that the import makeStyles from '@mui/styles/makeStyles'; would work at it did previously.

Steps to reproduce 🕹

Steps:

  1. Upgrade @mui/material 5.2.2 to 5.2.7 and test makeStyles

Context 🔦

Currently it is not an option rewrite to the new style of MUI v5, so I would like to be able to continue to use the old method.

Your environment 🌎

`npx @mui/envinfo`
  System:
    OS: Windows 10 10.0.19044
  Browser:
    Google Chrome
  Binaries:
    Node: 14.17.6 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 97.0.4692.71
    Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.55)
  npmPackages:
    @emotion/react: 11.7.0 => 11.7.0
    @emotion/styled: 11.6.0 => 11.6.0
    @mui/base:  5.0.0-alpha.58
    @mui/icons-material: 5.2.5 => 5.2.5
    @mui/lab: 5.0.0-alpha.58 => 5.0.0-alpha.58
    @mui/material: 5.2.2 => 5.2.2
    @mui/private-theming:  5.2.3
    @mui/styled-engine:  5.2.6
    @mui/styles: 5.2.3 => 5.2.3
    @mui/system:  5.2.8
    @mui/types:  7.1.0
    @mui/utils:  5.2.3
    @types/react:  17.0.38
    react: 17.0.2 => 17.0.2
    react-dom: 17.0.2 => 17.0.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
digicoffeycommented, Mar 22, 2022

Thank you @mnajdova I downgraded @mui/x-data-grid-pro to 5.2.0 which matches my other mui package versions and it is all working. When I get time I will upgrade all packages, but I just needed to get the license key installed.

0reactions
mnajdovacommented, Mar 22, 2022

Note that @mui/material and @mui/styles need to depend on the same version of @mui/private-theming otherwise the context would be different. Check if this is the case and update the versions accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: theme.spacing is not a function - Stack Overflow
This is not working because you have to type your Theme. import the Theme import { Theme } from '@mui/material'. Now type it:...
Read more >
mui/material/CHANGELOG.md - UNPKG
The CDN for @mui/material. ... 177, ### `@mui/material@5.2.7` ... 49 -->[docs] Remove create-mui-theme as it is no longer working (#29472) @IPJT.
Read more >
@mui/material | Yarn - Package Manager
MUI Base is our library of "unstyled" components and low-level hooks. With Base, you gain complete control over your app's CSS and accessibility...
Read more >
CHANGELOG.md · Gitee 极速下载/Material-UI - Gitee.com
Versions. 5.10.7. Sep 26, 2022. A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:.
Read more >
React MUI Spacing - GeeksforGeeks
It is an open-source React component library that implements Google's Material Design. In this tutorial, we will be learning how to add ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found