DEV Community

Cover image for Feedback form with Svelte

Feedback form with Svelte

Mikhail Kuznetcov on October 19, 2019

In this article I will show you how you can setup a Svelte project, add basic frontend form functionality with Svelte and then build the project. ...
Collapse
 
antony profile image
Antony Jones • Edited

Thanks for this - however I'd suggest a few small improvements:

  1. Don't create an object called STATE, it's unneccessary. Store each variable as a simple top-level variable in your component, and then make your validation attributes (valid, etc) reactive (using $:). That way you don't need to call validateForm() or do any of the manual legwork.

  2. You don't need to use redux with Svele. It's totally unneccessary. Svelte has stores, which is a simple, powerful cross-component state model. However for local component state - just use variables, as mentioned above.

  3. One of the most important differences between Svelte and Vue/React is that it is compiled. It's probably worth mentioning this in your intro :)

Collapse
 
shershen08 profile image
Mikhail Kuznetcov

Thanks for the detailed feedback Anthony. I would agree that using separate variables and adding reactive calculation could be a nice demonstration of this feature in Svelte.

Collapse
 
superski profile image
superski

Amazing!