-
-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
I'm trying to get some composition going and I ran into an issue with importing one svelte component into another. This is the code I'm working with. The main component looks like this:
<script lang="ts">
import TextInput from "./TextInput.svelte";
export let live;
let textInput = "";
function handleForm() {
live.pushEvent("validate-item", { name: textInput });
}
</script>
<form on:change|preventDefault={handleForm}>
<TextInput value={textInput} name="element" id="123456" />
</form>
And here we have the text input getting started.
<script lang="ts">
export let value: string;
export let name: string;
export let id: string;
</script>
<div>
<input
type="text"
{name}
{id}
bind:value
class="mt-2 block w-full rounded-lg text-zinc-900 focus:ring-2
sm:text-sm sm:leading-6 dark:bg-zinc-700 dark:text-zinc-100
inlinedark:placeholder-zinc-300"
/>
</div>
When I add the text input in, I'm getting this error:
[error] ** (NodeJS.Error) TextInput is not defined
And I've tried several ways of getting the imports going, including the relative import show, importing from $lib
, and importing relative to the elixir project root.
What am I missing? Is this something simple I should be approaching differently? I haven't been able to find an example of composing Svelte components inside a LiveSvelte project online.
Metadata
Metadata
Assignees
Labels
No labels