これは、フォームファイルである
import React from 'react';
import { Provider } from 'react-redux';
import { createStore,applyMiddleware } from 'redux';
import { combineForms } from 'react-redux-form';
import RecordForm from './components/RecordForm.jsx'
const initRecord= {
name: '',
SUKL: '',
ATC: ''
};
const store = createStore(combineForms({
record: initRecord
}));
@translate(['record'], { wait: true })
export default class App extends React.Component {
constructor(props){
super(props);
}
render() {
const { t }= this.props;
return (
<div>
<div className="row">
<div className="row header">
<h1>
{t('record.NewRecord')}
</h1>
</div>
<div className="row">
<Provider store={ store }>
<RecordForm />
</Provider>
</div>
</div>
</div>
);
}
このクラスcontaintsストアdefintionとプロバイダ:
import React from 'react';
import { connect } from 'react-redux';
import { Control, Form } from 'react-redux-form';
export default class RecordForm extends React.Component {
constructor(props){
super(props);
}
handleSubmit(record) {
const { dispatch } = this.props;
///dispatch is undefined !!!!!!!
}
render() {
return (
<div>
<Form model="record" onSubmit={(record) => this.handleSubmit(record)}>
<Control.text model="record.name" />
<button type="submit">
OK!
</button>
</Form>
</div>
);
}
}
私はhandleSumbitの一部を取得 - 発送は定義されていません。私がこれをデバッグすると、RecordFormのコンストラクタでさえ、o小道に出てくるか何かが書かれてという形式になっています。 connect()のような注釈を追加する必要がありますか?私は何を取りこぼしたか?