Open puddlejumper26 opened 4 years ago
Assume we have an exported component
function targetFunction() { } export (targetFunction)
When we need to import a function from another class, normall is like this
import { targetFunciton } from '../targetClass'; // call this imported function targetFunction();
And for the better understanding, actually we could also use the following method,
import { targetFunction as get } from '../targetClass'; //call this imported function get();
but it seems it is not used very often.
And we could also use export default as following
export default
function targetFunction() { } export default targetFunction;
export default could only be used once for one component. then for the import part we need to modify as following
import targetFunction from '../targetClass';
Assume we have an exported component
When we need to import a function from another class, normall is like this
And for the better understanding, actually we could also use the following method,
but it seems it is not used very often.
And we could also use
export default
as followingexport default
could only be used once for one component. then for the import part we need to modify as following