I'm working with Svelte and I'd like to ask how can I get the value of offset width of a div?
This is my code
<script>
export let students // string array
let divWidth;
console.log(divWidth) // this returns undefined, even though I bound it below
</script>
<style>
.container {
width: 250px;
}
</style>
<div class="container">
{#each students as student}
<div bind:offsetWidth={divWidth} >
{student}
</div>
{/each}
</div>
So basically I'd like to get the value of the offset width from each div, but it returns undefined. Any help would be appreciated!