6 Matching Annotations
- Oct 2020
-
github.com github.com
-
-
Svelte right now has a lot of opportunities to have component state become out of sync with props.
-
I'm suggesting this is a problem generally. Users will not think of being out of sync with props
-
Svelte doesn't re-render, so you need to respond to component mount/dismount and prop changes separately as they are distinct concepts and never tied together, unlike in React.
Tags
- general problem
- different way of thinking about something
- Svelte
- easy to get wrong
- UI library: reacting to prop changes
- trying to doing things the same way you did in a different library/framework (learning new way of thinking about something / overcoming habits/patterns/paradigms you are accustomed to)
- distinction
- easy to forget
- I have this problem
- issues I'm watching
- a problem worth solving properly
- lifecycle callbacks
- useEffect
Annotators
URL
-
-
dylanvann.com dylanvann.com
-
To fix our Svelte version you might think we could use beforeUpdate or afterUpdate, but these lifecycle functions are related to the DOM being updated, not to prop updates. We only want to rerun our fetching when the album prop is changed.
-
Beautiful, except that switching albums does not update the PhotoGrid. This is not the automatic reactivity we were promised by Svelte.
-