ValueError: Wrong number of items passed 2, placement implies 1
提供者
import { createMuiTheme, ThemeOptions } from '@material-ui/core/styles';
const theme = (options: ThemeOptions) => {
return createMuiTheme({
palette: {
primary: {
main: '#b5ddd1'
},
secondary: {
main: '#b2d9ea'
},
},
typography: {
fontFamily: 'Raleway, Arial',
button: {
fontStyle: 'italic',
},
},
...options,
})
}
import { ThemeProvider } from '@material-ui/core/styles'
<Provider store={store}>
<ConnectedRouter>
<ThemeProvider theme={theme}>
<GlobalStyles/>
{/*<ErrorBoundary>*/}
{/*<Layout>*/}
<Component {...pageProps} />
{/*</Layout>*/}
{/*</ErrorBoundary>*/}
</ThemeProvider>
</ConnectedRouter>
</Provider>
但是Button.js仍然出现错误
at样式(/ Users / filipbrezina / Documents / Projekty / sportee-frontend / node_modules / material-ui / core / Button / Button.js:33:78
有人可以帮我吗?我不知道我在做什么错?
答案 0 :(得分:2)
您定义/提供theme
的方式有误:
您需要像这样提供它:
<ThemeProvider theme={theme({})}> {/* function call: theme({}) */}
或者如果您这样定义它:
const theme = createMuiTheme({
palette: {
primary: {
main: '#b5ddd1',
},
// you can add more options
}
})
您可以通过以下方式提供它:
<ThemeProvider theme={theme}>