Skip to content
On this page

Svelte

You should create a main Svelte component named App.svelte as the entry point of your Svelte application. Your Svelte code should be linted using ESLint with the recommended configuration for Svelte.

Version

Running on Node.js v20.0.0

Supported languages

Typescript or Javascript

Testing framework

Jest

Special reminders and implementation details

js
import { render, fireEvent } from '@testing-library/svelte';
import Button from './Button.svelte';

test('button click updates count', async () => {
  const { getByText } = render(Button);
  const button = getByText('Click me');
  await fireEvent.click(button);
  expect(getByText('Clicked 1 times')).toBeInTheDocument();
});
1
2
3
4
5
6
7
8
9

Remember to always keep your components modular and make use of Svelte's reactivity, stores, and lifecycle functions for efficient data handling and DOM manipulations. Utilize Svelte's concise syntax to create interactive user interfaces with minimal boilerplate.

Included libraries