score:10
Accepted answer
checking the documents of material-ui it turns out you have imported some of the things from library in a wrong way. like the docs state -
import { usetheme } from '@material-ui/core/styles';
import { createmuitheme } from '@material-ui/core/styles';
which can basically be
import { usetheme, createmuitheme } from '@material-ui/core/styles';
same goes for themeprovider
import { themeprovider } from '@material-ui/core/styles';
score:6
in mui v5
you need to import themeprovider
and createtheme
from @mui/material/styles
instead of @mui/styles
.
import * as react from 'react';
import reactdom from 'react-dom';
import {red} from '@mui/material/colors';
import { themeprovider, createtheme } from '@mui/material/styles';
const theme = createtheme({
palette: {
primary: {
main: red[500],
},
},
});
function app() {
return <themeprovider theme={theme}>...</themeprovider>;
}
reactdom.render(<app />, document.queryselector('#app'));
Source: stackoverflow.com
Related Query
- Why is ThemeProvider (Material UI) not working for me here?
- Why is webpack code splitting not working for me?
- Why is my min value not working in my Material UI date textfield?
- 100% height not working for Drawer, Material Design React
- WithStyles not working in Material UI for React
- Material UI on ReactJS: `evt.target.value` not working for `RaisedButton`
- Why isn't HTML Entity in input title not working for React
- Why my dispatch is not working for button click event?
- Why is the JavaScript spread notation not working here
- Why is the preventDefault() method not working for me in my react application?
- Why is React redirect not working for me?
- Material UI Grid not working properly with Paper Component for nested Grid
- Material UI icon for Link Button not working
- why url() is not working for background img in React
- Toggle not working for material ui check boxes when printed in loop
- why does react code for 'hello React' not working
- I can't figure out why setState function not working for setting a value
- Why react route is not working in material ui?
- Why Multiple Remote federation module is not working for multiple remote child react app and a parent app?
- why is my setstate function is not working for the first call?
- Why is my Webpack not working for CSS Modules
- proxy not working for react and node
- Intellisense for Jest not working in VS code
- Why is getInitialState not being called for my React class?
- Why do I have to .bind(this) for methods defined in React component class, but not in regular ES6 class
- simulate for onClick not working in enzyme
- react-hook-form's setValue method is not working if input is in material ui dialog
- CSS modules not working for react version 16.6.0
- Why setCustomValidity() not working in React app?
- Material UI v5 server side rendering css order not working with gatsby
More Query from same tag
- How to set local JSON data as state using hooks React
- TypeError: Cannot read property 'question_set' of undefined
- ReactJS Material UI withStyles incl. theme in TS
- Reactjs POST request through axios
- How to make RootStore with Mobx6
- Form Submit Message in React
- React - Unable to modify input of childs child entity
- How to Divide React Components into Presentational and Container Components
- Axios in React for storing response for future use
- Trouble loading an objects src in ReactJS
- How to pass react component into dangerouslySetInnerHtml?
- NextJS Image component with fixed witdth and auto height
- how to hide a button in particular condition?
- React: reset password send email with reset password link to reset the password
- React select multi select one option not clearable
- how do i open a specific collapse accordian when using a anchor component in react typescript
- Nested Object Iteration with conditional statements ReactJs
- Multiple RouteHandler for a Route
- Fading from one image source to another in React
- extra (unwanted) space between grids
- How to render components in a nested route
- How to get sequence number in map function in JavaScript?
- hide components in app.js when a user is not logged in React
- Nothing appears while using react router
- In React i'm getting this.setState is not a function error within setTimeout/setInterval
- jsPDF not printing Japanese characters
- the command yarn run build throw errors
- How to make a Tab type simple component in React
- How to get the previous document in Firestore
- I am not getting the value onchange of togglebuttongroup material ui?