Skip to content

how to use in svelte5? #113

Closed
Closed
@Neptunium1129

Description

https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes

image

App.svelte

  import { writable } from 'svelte/store';
	import { mount } from 'svelte';
  import Modal, { bind } from 'svelte-simple-modal';
  import Popup from './Popup.svelte';
  const modal = writable(null);

  const showModal = () => modal.set(bind(Popup, { message: "It's a modal!" }));
</script>

<Modal show={$modal}>
  <button onclick={showModal}>Show modal</button>
</Modal>

Popup.svelte

<script>
  export let message = 'Hi';
</script>

<p>🎉 {message} 🍾</p>

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions