【发布时间】:2020-06-30 19:38:16
【问题描述】:
我收到此错误:
错误:Reference.update 失败:第一个参数包含属性“events.-MB5fWOoD9eJkz3EGdI5.at._locale.ordinal”中的函数,内容 = 函数(数字){ var b = 数字 % 10, 输出 = toInt(数字 % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; 返回数字+输出; }
这是表格
<form onSubmit={(e) => {
e.preventDefault();
if(text) {
props.startEditEvent(props.match.params.id, {
title: text,
at: date,
note: note
});
props.history.push("/");
}
}}>
这是异步操作:
export const editEvent = (id, changes) => ({
type: "EDIT_EVENT",
id,
changes
});
export const startEditEvent = (id, changes) => {
return (dispatch) => {
return database.ref(`events/${id}`)
.update(changes)
.then(() => {
dispatch(editEvent(id, changes))
})
}
};
【问题讨论】:
-
请编辑问题以显示您如何调用此功能(不要提供外部链接)。
changes到底是什么?错误消息说你正在传递一个函数,这是无效的。
标签: reactjs firebase firebase-realtime-database redux react-redux