Comment

Comment by satvikpendem

I don't really understand why people like signals again. I used a signals-like reactive programming model in VueJS a while ago and hated that you could never be sure exactly where things were being changed. Thankfully it seems that the React creators and maintainers are not hopping on the signals train and are instead adamant about unidirectional dataflow with explicit mapping of state to UI, which, as has been the reason for why React had been invented in the first place, makes reasoning about the application much easier [0][1].

This is a good thread about their drawbacks [2]. Apparently, both the below examples actually do different things:

    function One(props) {
      const doubleCount = props.count * 2;
      return <div>Count: {doubleCount}</div>
    }


    function Two(props) {
      return <div>Count: {props.count * 2}</div>
    }
Like the tweeter says, signals are mutable state. I'll stick with unidirectional data flow in React.

[0] https://twitter.com/jordwalke/status/1629663133039214593

[1] https://twitter.com/dan_abramov/status/1629539600489119744

[2] https://twitter.com/devongovett/status/1629540226589663233

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton