Hey there, I could really use some assistance with my Svelte app. I'm trying to implement a modal and pass a parameter to the modal component in order to customize its content. However, when using the open() function of Modal, we only need to provide the imported component, so I'm not sure how to pass the parameter.
Here is a snippet of the code I have:
import { getContext } from 'svelte';
import ModalContent from './ModalContent.svelte';
export let title;
const { open } = getContext('simple-modal');
const showModal = () => {
open(ModalContent);
};
What I'm aiming for is something like this:
import { getContext } from 'svelte';
import ModalContent from './ModalContent.svelte';
export let title;
const { open } = getContext('simple-modal');
const showModal = () => {
open(<ModalContent text={title} />);
};