News for hackers. Stuff that matters.
Re:React: You Might Not Need an Effect by orangepanda on Thursday March 23, 2023 @03:52AM (#35271637)
useEffect was designed to allow shooting yourself in the foot, in a good way. There's never a situation when react doesnt allow you to do something - the page even a mentions of synchronising with jquery!

Whats the alternative you propose? Not allowing react to be used with any 3rd party libraries or access to browser apis?

Re:React: You Might Not Need an Effect by rawoke083600 on Thursday March 23, 2023 @04:38AM (#35271868)
>useEffect was designed to allow shooting yourself in the foot, in a good way.

Ok... no... there is no good way to shoot yourself in the foot (metaphorically or real)

>There's never a situation when react doesnt allow you to do something

That is EXACTLY what I DONT want from my framework:

Re:React: You Might Not Need an Effect by foldr on Thursday March 23, 2023 @05:09AM (#35272056)
[allow shooting yourself in the foot] in a good way
Re:React: You Might Not Need an Effect by ohgodplsno on Thursday March 23, 2023 @06:59AM (#35272797)
>That is EXACTLY what I DONT want from my framework:

Unless you're happy about never going out of the guardrails set by your framework, there's going to come a point where, one way or another, you're going to need to interact with something outside of it. Are you going to wait for an official React-WASM way to interact with WASM (which is going to be using useEffect under the hood anyways)?

Frameworks with no escape hatches are hell. The escape hatch just needs to be bright, bold and with a warning on it that says "there can be demons behind that hatch, watch out".

Re:React: You Might Not Need an Effect by nateabele on Thursday March 23, 2023 @10:59AM (#35275842)
So, that's accurate, but doesn't correspond to the situation. At all.

'Escape hatches' are definitionally exceptions to the rules, whereas effects in React are standard practice.

Re:React: You Might Not Need an Effect by ohgodplsno on Friday March 24, 2023 @03:38AM (#35286172)
Because React evolves in an ecosystem which is wide and varied. It's easy to be Elm and have no escape hatches when you make the language, the libraries, the standard library and the world. It's a bit harder when you have to interact with 30 years of crap.
Re:React: You Might Not Need an Effect by justusw on Thursday March 23, 2023 @04:05AM (#35271704)
Sorry for the disgruntled snark in advance:

Heh, we already have that and it is called Elm.

By me, an Elm user until 0.18.

Re:React: You Might Not Need an Effect by Kimitri on Thursday March 23, 2023 @09:10AM (#35274174)
Yeah, it's a right pain to deal with non-Elm things in Elm (including JSON data sources). It's possible but you will want to avoid it. However, I think I'd still take Elm over React if I didn't have to care about anyone else but myself.
Re:React: You Might Not Need an Effect by MrPatan on Thursday March 23, 2023 @05:30AM (#35272165)
Yes