【发布时间】:2022-11-23 21:21:01
【问题描述】:
我制作了一个辅助类,其中包含许多要从不同组件调用的函数,但我无法从调用辅助函数的主组件获取返回值?请帮忙 ..
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 ?
【问题讨论】:
-
请添加一些示例或代码。
-
先生,我编辑问题请看一下..请帮助..
标签: reactjs react-native