This is a solution to the Newsletter sign-up form with success message challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
This is my attempt to learn Svelte with SvelteKit framework and also enhancing my TailwindCSS skill.
Users should be able to:
SvelteKit has filesystem-based router. To create a route, you only need to create +page.svelte
file under src/route/path/to/your/route
directory. For example
src/routes/about/+page.svelte
will define /about
routeSvelte is superset of HTML. It means, any HTML file is a valid Svelte file, but not the other way around. This makes learning curve to start Svelte from learning HTML is incredibly easy.
When in doubt, you can launch Svelte REPL online and test your Svelte code there. Lot of people shared their knowledge throught snippets using online Svelte REPL. This makes the community grows fast.
We can decompose a page into smaller and reusable chunks / components. We can pass props to the component, make it reactive, and integrate with Svelte directives.
Handling forms in svelte is hard (at least that what I feel). So I decided to use another dependency (svelte-forms) for handling form validation.