News for hackers. Stuff that matters.
Re:Thoughts on Svelte by azangru on Monday March 27, 2023 @11:58AM (#35328326)
> That is literally what useEffect is for!

No, sorry; for useEffect to fire, a prop or a state needs to change; which means that the component is going to re-render. My point is that sometimes we want to observe properties passed to the component for side-effect purposes without re-rendering the component.

> Functional programmers believe in minimizing side effects.

In order to do something — anything — in the real world, we need side effects. Even Haskellers know this :-)

Re:Thoughts on Svelte by johtso on Monday March 27, 2023 @01:19PM (#35329437)
Sounds like the prop shouldn't be getting passed to the component then if the component isn't using it to render itself? Maybe it should be getting sent straight to your "store" perhaps? Let the components take care of the rendering, let your "store"/"state machine"/whatever take care of the side effects.
Re:Thoughts on Svelte by schwartzworld on Monday March 27, 2023 @01:59PM (#35330001)
>> Functional programmers believe in minimizing side effects.

> In order to do something — anything — in the real world, we need side effects. Even Haskellers know this :-)

Hence the use of the word "minimize"