DEV Community

loading...

Discussion on: Feedback form with Svelte

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.