所以出了点问题,我想不通,就像以前的某些案例一样:
具有启发性和动作感,动作创造者:
...config
firebase.initializeApp(config);
export const firebase_db = firebase.database().ref();
export const POST_DATA = 'POST_DATA';
export function PostData(post) {
return dispatch => firebase_db.push(post);
减速器:
export default function(state={}, action) {
switch (action.type) {
case POST_DATA:
return {...state, ...action.payload}
};
return state;
和表格,状态:
class NewInput extends Component {
constructor(props) {
super(props);
this.state = {
adress: [],
owner: [],
city: [],
floor: [],
year: [],
description: [],
data: []
};
}
onSubmit(values) {
this.props.PostData(this.state.data);
}
handleChange(event) {
this.setState({[event.target.name]: [event.target.value]});
this.state.data = [...this.state.adress, ...this.state.owner, ...this.state.city, ...this.state.floor, ...this.state.year, ...this.state.description]
没有任何错误,当控制台记录this.state.data时,会有预期的数据...任何人都可以帮忙吗?
答案 0 :(得分:0)
发现了问题,它是redSub形式的onSubmit问题,它是用磨损的方式写的...