I'm a novice explorer of Svelte and I am experimenting with incorporating LeaderLine into a Svelte application. After successfully importing it using
import LeaderLine from 'leader-line';
, I encountered an issue with the example provided on the package page not functioning as expected:
<script>
import LeaderLine from 'leader-line';
new LeaderLine(
document.getElementById('start'),
document.getElementById('end')
);
</script>
<div id="start">start</div>
<div id="end">end</div>
I received this error in the browser console:
Uncaught (in promise) Error: start and end are required.
This problem seems to be related to the use of getElementById
, which is generally discouraged in the context of Svelte development. I'd like to seek suggestions or solutions from the community on how to successfully integrate LeaderLine with Svelte. Any insights or ideas would be greatly appreciated!