When using redux-form with the new v1-alpha version, the redux-form is unable to get the values from material-ui's inputs:
I've been using v1-alpha with the redux-form and it's working for me. I use as the example in the redux-form docs.
hmm that is a redux-form thing, you have to configure each type of field like @AugustoOdy did
I thought that with v1 we could drop the redux-form-material-ui. But instead we need a new version of it as well.
Personally, I have been using the following wrapper. It's a small adapter.
RFTextField.js
import React from 'react'
import PropTypes from 'prop-types'
import TextField from 'material-ui/TextField'
function RFTextField(props) {
const { autoComplete, input, meta: { touched, error }, ...other } = props
return (
<TextField
error={Boolean(touched && error)}
{...input}
{...other}
inputProps={{
autoComplete,
}}
helperText={touched ? error : ''}
/>
)
}
RFTextField.propTypes = {
autoComplete: PropTypes.string,
input: PropTypes.object.isRequired,
meta: PropTypes.shape({
touched: PropTypes.bool.isRequired,
error: PropTypes.string,
}).isRequired,
}
export default RFTextField
@gfpacheco Yes, it makes sense to update the redux-form-material-ui adapter project for the new version so we can have an even simpler experience.
@oliviertassinari how can we use the new <Select> with redux-form?
@HriBB While redux-form-material-ui still don't fully support v1 (I'm working on a PR) you can use my version of it:
npm install --save @gfpacheco/[email protected]
@HriBB It's the same API as a native select.
Most helpful comment
Personally, I have been using the following wrapper. It's a small adapter.
RFTextField.js
@gfpacheco Yes, it makes sense to update the
redux-form-material-uiadapter project for the new version so we can have an even simpler experience.