如何使用React Native中另一个文件的函数
我需要在file home.js,在file settings.js中使用函数。我正在使用功能组件。我需要使用函数const getTempBucketData =()=> {}
在settings.js中从home.js获取数据。
I need to use a function from file Home.js , in file Settings.js. I'm using functional components. I need to use the function const getTempBucketData = () => {}
that fetch data from Home.js, in Settings.js.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用所需功能编写导出关键字,然后只需使用导入而导入该特定功能
例如:
现在您可以合法地在此文件中使用此funcname
you should write the export keyword with the required function and then simply import that particular function using the import
for instance:
now you can use this funcName in this file legally