News for hackers. Stuff that matters.
Re:React Won by Default – and It's Killing Front End Innovation by hbrn on Tuesday September 16, 2025 @11:15AM (#45263457)
> React feels natural because it never asks you to stop writing JavaScript

I want to increment some counter on the webpage. Which approach feels natural?

  increment = () => {
    this.setState((prevState) => ({ count: prevState.count + 1 }));
  };

  const increment = () => setCount((count) => count + 1);

  function increment() {
    count += 1;
  }
No one wakes up saying "please let me mutate simple state with function calls".
Re:React Won by Default – and It's Killing Front End Innovation by b_e_n_t_o_n on Tuesday September 16, 2025 @04:21PM (#45267454)
The third example is missing the data binding that you get automatically with React. It should look more like this:

   function increment() {
     count += 1;
     dispatchEvent(new CustomEvent(
       "count-incremented", 
       { detail: { count } }
     ));
   }
I think I prefer not having to manage events all over the place.
Re:React Won by Default – and It's Killing Front End Innovation by hbrn on Wednesday September 17, 2025 @11:45AM (#45277237)
Third example was supposed to be Svelte.

Vue also isn't too far:

  function increment() {
    count.value += 1
  }
In 2025, React state management is complete shitshow compared to Svelte and Vue.

How in the world people are claiming "React is just Javascript" is beyond me.

Re:React Won by Default – and It's Killing Front End Innovation by 3nt3 on Thursday September 18, 2025 @01:13AM (#45285685)
Haskell devs do ;)