Reactjs 材质UI:如何正确设置服务器端渲染的userAgent

Reactjs 材质UI:如何正确设置服务器端渲染的userAgent,reactjs,react-router,material-ui,Reactjs,React Router,Material Ui,我收到这个警告: Material-UI: userAgent should be supplied in the muiTheme context for server-side rendering 使用以下服务器端渲染设置,我做错了什么: match({routes: R(), location}, (error, redirectLocation, renderProps) => { if (error) { console.err

我收到这个警告:

    Material-UI: userAgent should be supplied in the muiTheme 
    context for server-side rendering
使用以下服务器端渲染设置,我做错了什么:

    match({routes: R(), location}, (error, redirectLocation, renderProps) => {
    if (error) {
        console.error("error: "+ error)
    } else if (redirectLocation) {
        console.error("redirect to " + redirectLocation)
    } else if (renderProps) {

        const theme = getMuiTheme({userAgent: "all"})

        page = ReactDOMServer.renderToStaticMarkup(
        <MuiThemeProvider muiTheme={theme}>
            <Provider store={store}>
                <RouterContext {...renderProps} />
            </Provider>
        </MuiThemeProvider>
        )
    } else {
        console.error("location nof found: '"+ location +"'")
    }
    })
match({routes:R(),location},(错误,重定向位置,renderProps)=>{
如果(错误){
console.error(“error:+error”)
}else if(重定向位置){
控制台错误(“重定向到”+重定向位置)
}else if(渲染器操作){
const theme=getMuiTheme({userAgent:“all”})
page=ReactDOMServer.renderToStaticMarkup(
)
}否则{
console.error(“找到的位置编号:“+location+”))
}
})
在这个项目中,我是这样设置的:

:

renderString(:

render(:

类主扩展组件{
构造函数(属性、上下文){
超级(属性、上下文)
this.muiTheme=getMuiTheme({
userAgent:properties.userAgent
})
}
render(){
返回(
)
}
}

它工作得很好,我认为它也是正确的。

可能重复的我也有同样的问题。从材料ui文档中,似乎“所有”用户代理都应该工作,但它不工作。此外,请仔细检查服务器和客户端的环境是否与文档中描述的相同。
renderToString(<Application userAgent={request.headers['user-agent']} />)
render(<Application userAgent={navigator.userAgent} />, document.getElementById('root'))
class Main extends Component {
    constructor(properties, context) {
        super(properties, context)

        this.muiTheme = getMuiTheme({
            userAgent: properties.userAgent
        })
    }

    render() {
        return (
            <MuiThemeProvider muiTheme={this.muiTheme}></MuiThemeProvider>
        )
    }
}