What is the difference between using functions from outer-scope (foo and aFunctionFromOuterScope below) and inner-scope (bar and aFunctionFromInnerScope below) in a export default function?
const foo = () => //...
const aFunctionFromOuterScope = () => //...
export default function() {
const aFunctionFromInnerScope = () {
foo() // use foo function from outer scope
bar() // use bar function from inner scope
});
const bar = () => //...
//...
return {
aFunctionFromInnerScope ,
aFunctionFromOuterScope
};
}
When should I use one or the other?