Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在redux中使用材质ui?_Reactjs_Redux_Material Ui_Redux Form - Fatal编程技术网

Reactjs 在redux中使用材质ui?

Reactjs 在redux中使用材质ui?,reactjs,redux,material-ui,redux-form,Reactjs,Redux,Material Ui,Redux Form,我目前正在以这种方式渲染主组件: ReactDOM.render( <Provider store = {store}> {getRoutes(checkAuth)} </Provider>, document.getElementById('app') ) ReactDOM.render( {getRoutes(checkAuth)} , document.getElementById('app') )

我目前正在以这种方式渲染主组件:

 ReactDOM.render(
      <Provider store = {store}>
        {getRoutes(checkAuth)}
      </Provider>,
      document.getElementById('app')
    )
ReactDOM.render(
{getRoutes(checkAuth)}
,
document.getElementById('app')
)
文档状态为使用MuiThemeProvider包装我的应用程序组件。我一直在使用提供商包装,任何关于如何在redux应用程序中使用材质ui的建议。我正在尝试在redux表单字段中添加材质ui,如下所示:

import React, { PropTypes } from 'react'
import {default as ReactModal} from 'react-modal'
import {Field, reduxForm} from 'redux-form'
import {TextField} from 'material-ui'

const customStyles = {
  overlay: {
    position: 'fixed',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    backgroundColor: 'rgba(0, 0, 0, 0.55)'
  },
  content: {
    top: '50%',
    left: '50%',
    right: 'auto',
    bottom: 'auto',
    marginRight: '-50%',
    transform: 'translate(-50%, -50%)'
  }
}

const modalForm = (props) => {
  // console.log(props)
  const { handleSubmit, pristine, reset, submitting } = props
  return (
    <div>
      <button onClick= {props.openModal}>Duck</button>
      <ReactModal
      isOpen={props.isOpen}
      style={customStyles}
      onRequestClose={props.closeModal}>

  <h1>Compose New Duck</h1>
  <form onSubmit= {handleSubmit}>
  <label>duck</label>
    <Field name ='duck' component = {(duck) =>
      <TextField hintText = 'Enter Duck'
        floatingLabelText = 'Enter Duck here'
        {...duck} />} />

  </form>
  <button onClick= {props.closeModal}>Close Modal...</button>
</ReactModal>
    </div>
  )
}

export default reduxForm({
  form: 'duckModal'  // a unique identifier for this form
})(modalForm)
import React,{PropTypes}来自“React”
从“react-modal”导入{default as-ReactModal}
从“redux form”导入{Field,reduxForm}
从“材质ui”导入{TextField}
常量自定义样式={
覆盖:{
位置:'固定',
排名:0,
左:0,,
右:0,,
底部:0,
背景颜色:“rgba(0,0,0,0.55)”
},
内容:{
前50%,
左:50%,
右图:“自动”,
底部:“自动”,
利润率:'-50%',
转换:“转换(-50%,-50%)”
}
}
const modalForm=(道具)=>{
//控制台日志(道具)
const{handleSubmit,pristite,reset,submiting}=props
返回(
鸭子
编新鸭
鸭子
} />
关闭模式。。。
)
}
导出默认reduxForm({
表单:“duckModal”//此表单的唯一标识符
})(modalForm)

尝试了以下方法,效果良好:

 const App = () => (
    <MuiThemeProvider>
      <Provider store = {store}>
        {getRoutes(checkAuth)}
      </Provider>
    </MuiThemeProvider>
    )

  ReactDOM.render(
    <App/>,
  document.getElementById('app')
)
const-App=()=>(
{getRoutes(checkAuth)}
)
ReactDOM.render(
,
document.getElementById('app')
)

我建议您参考。

尝试了以下方法,效果良好:

 const App = () => (
  <Provider store = {store}>
    <MuiThemeProvider>
      {getRoutes(checkAuth)}
    </MuiThemeProvider>
  </Provider>
)
const-App=()=>(
{getRoutes(checkAuth)}
)

在示例中找不到页面