I wanted to use some function from javascript module in one of my component. Should I pass it in props when making the component or should I just use Imports in component itself to get the javascript function?
Example of Passing in Svelte component:
Proxy.js
var Proxy = {
test: function() {
.....
}
}
export default Proxy;
Dashboard.svelte
<script>
export let Proxy;
// use Proxy test function now
</script>
Example of import JS
Proxy.js
var Proxy = {
test: function() {
.....
}
}
export default Proxy;
Dashboard.svelte
<script>
import Proxy from "../Proxy.js"
// use Proxy test function now
</script>
Which is better way to do in svelte components or any frontend code for that matter?