redux-form-utils
redux-form-utils copied to clipboard
这个还能用吗
为什么我看react深入技术栈的时候,用到的redux-componble-fetch和redux-form-utils都不行呢。
具体遇到什么问题?
redux-form-utils: TypeError: Cannot read property 'object' of undefined
`import React,{Component} from 'react'; import { createForm } from 'redux-form-utils';
@createForm({ form:'my-form', fields:['name', 'address', 'gender'], })
class Form extends Component {
render(){
const { name, address, gender } = this.props.fields;
return (
<form className='form'>
<div>
<label htmlFor="firstName">First Name</label>
<imput name='name' {...name} />
</div>
</form>
)
} }
export default Form;`
redux-componble-fetch: 事件派发是成功的,但是数据在action中没返回,我看你写的是action.payload.articleList 我把action打印出来console.log(action) 并没有找到返回的数据
错误的完整堆栈贴一下吧,或者最好能把完整的代码做一个可复现的 repo,从你目前提供的信息看不出问题在哪里
git clone https://github.com/XueMary/utils-and-fetch.git
yarn insatll
cd mock
yarn run mock //启动数据 json-server
cd ..
yarn start
里面加载了 redux-componble-fetch 和 redux-form-utils 感谢你的帮助
粗看了一下,是因为标签名拼错了? https://github.com/XueMary/utils-and-fetch/blob/6f77740355d22b37711475ac2b8435758e518229/src/components/Form/Form.js#L19
不不不,修改后依旧是错误的
@XueMary 你的问题解决了吗?我也遇见了这样的问题
同样的问题报错,在这个地方提示
Cannot read property 'object' of undefined
ReduxForm.propTypes = { form: _react.PropTypes.object };