我正在使用react,redux以及firebase。我的动作如下:
export function addPost(postData) {
firebase.database().ref('posts').push().update({
title: postData.title,
text: postData.text,
userId: firebase.auth().currentUser.uid,
postid: ?????????
})
return {type: "ADD_POST", payload: postData}
}
我想在firebase数据库中创建如下内容:
LY7iT1sgmJvjCmBh1GZ: {
title: some title,
text: some text,
postid: LY7iT1sgmJvjCmBh1GZ
}
LY7iT1sgmJvjCmBh1GZ是通过推送方法生成的唯一密钥。我希望我的postId属性相同-如何实现此目标?