DEV Community

Discussion on: How I moved from React to Svelte

Collapse
 
shanwshaw profile image
shawnshaw

tried that and dislike sveltekit since I need zero SSR get involved.

so I went back to svelte, used svelte-spa-router to do client side routing(by the way, can svelte add a client side router by default), then I was looking for a state management solution(is context api my only option for CSR state management?), then for more options on UI libs(sveltestrap)...

my hope is that, svelte adds a client side routing built-in to keep its svelte CSR friendly, has some nice state management lib for the CSR, and keep SSR to sveltekit instead of svelte core, just do not sell sveltekit as CSR solution, it is not.

Thread Thread
 
webjose profile image
José Pablo Ramírez Vargas

For state management, use Svelte stores:

// stores/myCounter.js
import { writable } from 'svelte/store';

export myCounter = writeable(0);
Enter fullscreen mode Exit fullscreen mode

Then import anywhere you need the counter.

As for routing, there won't be an official CSR router. Only SvelteKit has routing. If you need routing, you'll find 2 or 3 options to choose from if you surf the WWW.