How is Sapper different from Next.js?
Next.js is a React framework from Zeit, and is the inspiration for Sapper. There are a few notable differences, however:
- It's powered by Svelte instead of React, so it's faster and your apps are smaller
- Instead of route masking, we encode route parameters in filenames. For example, the page you're looking at right now is
- As well as pages (Svelte components, which render on server or client), you can create server routes in your
routes directory. These are just
.js files that export functions corresponding to HTTP methods, and receive Express
response objects as arguments. This makes it very easy to, for example, add a JSON API such as the one powering this very page
- Links are just
<a> elements, rather than framework-specific
<Link> components. That means, for example, that this link right here, despite being inside a blob of HTML, works with the router as you'd expect.