Pular para o conteúdo principal
ProdutosFerramentas de desktopTASTECADVisualização de desenhosTASTEFILESGerenciamento de arquivosTASTEFTPTransferência de arquivosTASTESSHEspaço de trabalho remotoTASTEZIPCompactação e extraçãoTASTEWINMGerenciamento de arquivosFerramentas para desenvolvedoresTASTECODEAmbiente de desenvolvimento integrado para RustTASTESTUDIOAmbiente integrado de desenvolvimento e testesTASTEETLIntegração de dados (ETL)ServidoresTASTEREMOTEServidor de área de trabalho remotaTASTEGEOServidor geoespacialTASTEMAILEspaço de trabalho de e-mailInvestimentosTASTESTOCKAplicativo desktop de negociação automática de açõesComeçarDownloadsDocumentaçãoComprarTodos os produtos
Marketplace
Notícias
TecnologiaNotíciasNotícias de desenvolvimento de hojeDocumentaçãoLinguagens de programaçãoRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks de front-end webNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks de apps e desktopTauriFlutterReact NativeElectronAlgoritmosFundamentos de algoritmosAlgoritmos essenciaisAlgoritmos avançadosAlgoritmos práticos
ComunidadeProjetosRegistros de desenvolvimentoPromptsProblemas de ferramentas de IAVitrineGuia da comunidade
ColaboreTransferência técnicaConstrução de siteConstrução de app de desktopPipeline de lançamento e pagamentoParceiro de vendasContato
ServiçosÁrea de trabalho remotaPacotes de instalação sob medida
TASTEDEV
Produtos

Ferramentas de desktop

TASTECADDesenhos complexos, abertos com levezaTASTEFILESSó os arquivos de que você precisa, o mais rápido possívelTASTEFTPO caminho mais organizado para seus arquivosTASTESSHEntre você e o servidor, uma conexão mais sólidaTASTEZIPCompacte mais rápido, extraia com mais segurançaTASTEWINMUm gerenciador de arquivos de dois painéis feito para o teclado

Ferramentas para desenvolvedores

TASTECODEEdite, compile, depure e teste apps Rust em uma única janelaTASTESTUDIODa edição aos testes remotos e às correções com IA aprovadasTASTEETLMova dados de olho nos valores

Servidores

TASTEREMOTEUma área de trabalho remota rodando no seu próprio servidorTASTEGEOUm servidor geoespacial compatível com o GeoServer, reconstruído em RustTASTEMAILRetome o controle do seu e-mail

Investimentos

TASTESTOCKNegociação automática de ações pelas regras que você define: quando e o quê

Começar

DownloadsVersões mais recentes de cada produtoDocsComo usar cada produtoComprarAssinaturas e licenças perpétuasTodos os produtosTodos os produtos de relance
Todos os produtos
MarketplaceNotícias
Tecnologia

Notícias

Notícias de desenvolvimento de hojeAnúncios oficiais de linguagens, frameworks, GitHub e IADocumentaçãoGuias de linguagens, frameworks e algoritmos

Linguagens de programação

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks de front-end webNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks de apps e desktopTauriFlutterReact NativeElectron

Algoritmos

Fundamentos de algoritmosAnálise de complexidade · Ordenação · Busca · Estruturas de dados básicas · Árvores e heapsAlgoritmos essenciaisBusca em grafos · Caminho mínimo e árvore geradora mínima · Programação dinâmica · Algoritmos gulosos · Divisão e conquista · BacktrackingAlgoritmos avançadosAlgoritmos de strings · Matemática e teoria dos números · Manipulação de bits · Árvores de segmentos · Union-FindAlgoritmos práticosEstratégia para entrevistas de código · Cache LRU · Limitação de taxa · Hashing consistente
Toda a documentação de desenvolvimento
Comunidade
ProjetosDescubra criadores e trabalhosRegistros de desenvolvimentoDecisões e aprendizadosPromptsInstruções reutilizáveisProblemas de ferramentas de IAProblemas e contornos de Claude, Codex, GeminiVitrineResultados concluídosGuia da comunidadeComo construímos em aberto
Colabore
Transferência técnicaApps nativos em Rust e eguiConstrução de site10 idiomas, contas, documentação e downloadsConstrução de app de desktopRust e egui, sem WebViewPipeline de lançamento e pagamentoAssinatura, MSI, deb, rpm, AppImage, hashesParceiro de vendasRecomende e ganhe 30%ContatoDesenvolvimento, parcerias e investimento
Serviços
Área de trabalho remotaAcesse seu computador pelo navegadorPacotes de instalação sob medidaSó o necessário, configurações pré-carregadas
Comprar
PT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Entrar
Entrar
TASTEDEV

De pequenas ferramentas a um desenvolvimento melhor.

support@tastedev.netApoiar TASTEDEV
ProdutosLinha de produtosComprarDocsDownloadsMarketplaceSuporte
ComunidadeProjetosRegistros de desenvolvimentoPromptsProblemas de ferramentas de IAVitrine
PolíticasSobre nósPolítica de privacidadeTermos de usoTermos de assinaturaReembolsoDiretrizes da comunidade
ContaEntrarCriar conta
Visitantes
Hoje
Ontem
Visualizações totais
Empresa
GXSOFT
Representante
CHOI YOUNG GU
Número de registro comercial
853-44-00368
Endereço
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefone
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsável pela privacidade
CHOI YOUNG GU

© 2026 TASTEDEVAs informações dos produtos se baseiam em fontes de desenvolvimento verificadas.Lançado · em melhoria

Documentação de SvelteKit
SvelteKit
Getting Started with SvelteKitProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Discussões

Guia de SvelteKit · 3/6

Core Concepts

Por enquanto, este capítulo está disponível apenas em inglês.

SvelteKit has two layers worth understanding: Svelte components and runes, which build the UI, and SvelteKit's routing and rendering model, which maps those components to URLs and renders them on the server and in the browser.

Svelte components

Each .svelte file is one component. Logic goes in <script>, markup follows it, and styles go in <style>, which is scoped to that component by default. Svelte compiles the file into code that updates exactly the parts of the DOM that changed, with no virtual DOM.

Runes: $state, $derived, $effect, $props

The current generation of Svelte (Svelte 5) expresses reactivity with runes, special symbols that start with $. They look like functions, but they are syntax understood by the compiler, so you never import them.

RunePurpose
$stateState that updates the UI when it changes
$derivedA value computed from other state
$effectA side effect that runs after state changes (DOM work, timers, third-party libraries)
$propsReceive the props passed by a parent
$bindableMark a prop that a parent can bind to two-way
<script lang="ts">
  let items = $state<string[]>([]);
  let text = $state('');

  let total = $derived(items.length);
  let empty = $derived(total === 0);

  $effect(() => {
    document.title = `${total} todos`;
  });

  function add() {
    if (text.trim()) items.push(text.trim());
    text = '';
  }
</script>

<input bind:value={text} />
<button onclick={add}>Add</button>

{#if empty}
  <p>Nothing to do.</p>
{:else}
  <ul>
    {#each items as item}
      <li>{item}</li>
    {/each}
  </ul>
{/if}

Arrays and objects created with $state are deeply reactive, so mutating them directly with items.push() updates the UI. Reach for $derived whenever a value can be computed, and keep $effect for genuine side effects. Effects only run in the browser, never during server-side rendering.

Props and snippets

A child component receives props through $props(). Instead of the older export let syntax and on:click directives, you destructure props and use plain attributes such as onclick. Markup passed to a child becomes a snippet, which the child renders with {@render ...}.

Dúvidas sobre este capítulo?
Capítulo anteriorProject StructurePróximo capítuloData and State
<!-- src/lib/components/Card.svelte -->
<script lang="ts">
  import type { Snippet } from 'svelte';

  let { title, highlighted = false, children }: {
    title: string;
    highlighted?: boolean;
    children: Snippet;
  } = $props();
</script>

<section class:highlighted>
  <h2>{title}</h2>
  {@render children()}
</section>
<script lang="ts">
  import Card from '#lib/components/Card.svelte';
</script>

<Card title="Notice" highlighted>
  <p>Scheduled maintenance tomorrow.</p>
</Card>

File-based routing and layouts

In SvelteKit, the folder structure of src/routes is your URL structure. +page.svelte is a page, and +layout.svelte wraps the pages in its folder and below. A layout receives a children snippet and renders it where the page should appear.

<!-- src/routes/+layout.svelte -->
<script lang="ts">
  import { page } from '$app/state';
  let { children } = $props();
</script>

<nav>
  <a href="/" aria-current={page.url.pathname === '/' ? 'page' : undefined}>Home</a>
  <a href="/blog">Blog</a>
</nav>

<main>
  {@render children()}
</main>

page from $app/state is a reactive object holding the current URL, route params, page data and error. The older $app/stores module and its $page store have been removed in the current release. Links are ordinary <a> elements: SvelteKit intercepts clicks and performs a client-side navigation that updates only what changed.

SSR, CSR and prerendering

By default, SvelteKit server-side renders the first request into complete HTML, hydrates it in the browser to make it interactive, and handles later navigations with client-side rendering. You change this per route with page options exported from +page.ts or +layout.ts.

// src/routes/about/+page.ts
export const prerender = true; // generate static HTML at build time

// in src/routes/dashboard/+layout.ts you might write
// export const ssr = false;   // render in the browser only, SPA-style
// export const csr = false;   // ship HTML with no JavaScript
OptionDefaultMeaning
prerenderfalsetrue generates HTML at build time; 'auto' also keeps the route available for server rendering
ssrtruefalse sends an empty shell and renders in the browser
csrtruefalse ships no JavaScript

Options set in the root layout apply to the whole app; options in a nested folder apply only below it. Prerender pages that are the same for everyone, like blog posts and docs; use SSR for per-user pages; and consider ssr = false for screens that lean heavily on browser APIs, such as an editor.

Summary

  • Component reactivity is expressed with runes: $state, $derived, $effect and $props.
  • Events are plain attributes like onclick; child markup is passed as snippets and drawn with {@render}.
  • +page.svelte and +layout.svelte in src/routes define pages and shared shells.
  • Choose a rendering strategy per route with the prerender, ssr and csr options.

0 comentários

Principais comentáriosMais recentes primeiro

Fazer login · Faça login para deixar um comentário.