我已经做了一个帮助类,包含了很多函数要从不同的组件调用,但我不能在主组件上得到返回值,从那里得到调用帮助函数?请帮助..
helper1: function(){
console.log("ok Pressed");
},
checkIfRoomExist: function(param1, param2){
console.log("userid", param2);
firestore()
.collection('userlist')
.doc(param2)
.get()
.then(documentSnapshot => {
console.log("room_id=>", documentSnapshot.data().room_id)
})
},
helper3: function(param1, param2){
}
}
export default helpers; `
This is my helper class and i call it from my components and like
`import helper from './helper';`
Then Call the function and pass params like
`onPress={() => helper.checkIfRoomExist(param1, param2)}`
and now here i want the result of the checkIfRoomExist() function , how ?
1条答案
按热度按时间lf5gs5x21#
这是功能组件示例,
//类别元件范例