In my application I'm applying a custom theme as described in the Material UI docs.
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core';
const App = () => {
const theme = createMuiTheme({ palette: { primary: { main: 'red' } } });
return (
<MuiThemeProvider theme={theme}>
<Route path="/" component={Home} />
</MuiThemeProvider>
);
}
But what happens is that if I apply a Button from the core package, it get's the correct override color (in this case red). But then a re-render happens and suddenly it changes the color to the default Material UI color which is blue.
The odd thing is that if I look in the source code of the page, there are two instances of a style tag applied:
The first style tag contains the 'red' color. But the second style tag contains the default Material UI color (#3f51b5
).
I have no idea where to look.