提问人:Sanman Chavan 提问时间:8/22/2020 最后编辑:Sanman Chavan 更新时间:8/22/2020 访问量:130
返回普通对象的通用函数,可以在不同的REACT功能组件之间使用
Common function which returns plain object ,can be use between different REACT Functional Component
问:
使用下面的脚本==>
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
我想使用一个需要在多个组件中使用的自定义验证的通用函数
//present in my Helpers.js
export function myCommonFunc(name) {
const temp = 'some more operation ';
return "Hello ==>" + name + " ==>" + temp + " done"; //define it according to our needs
}
//multiple components I want to use, one of them is as follow
import { myFunc } from "Helpers";
const OneContainer ({ }) => {
myFunc ('Dev')
}
低于错误
未捕获的 ReferenceError:未定义 require
答: 暂无答案
评论