News for hackers. Stuff that matters.
Re:React has grown beyond its original promise and it's caus... by hombre_fatal on Friday February 09, 2024 @09:22AM (#39315099)
You're probably right about Elm which is basically one big reducer, but Redux adds a whole lot more indirection on top of that which makes it much more complicated.

Even small Redux apps can start off with a lot of indirection as soon as they extract logic into selectors. This is probably the first area where Redux becomes more complex that what you were doing before:

https://redux.js.org/usage/deriving-data-selectors

It reminds me of reading a bunch of parser combinators: it feels like you're reading code that builds something that does what you want instead of the code that just does what you want.

    const makeSelectItemsByCategory = () => {
      const selectItemsByCategory = createSelector(
        [state => state.items, (state, category) => category],
        (items, category) => items.filter(item => item.category === category)
      )
      return selectItemsByCategory
    }
Re:React has grown beyond its original promise and it's caus... by elbear on Tuesday February 13, 2024 @04:46AM (#39356094)
Yeah, with Elm, when you handle an event, you either update the model (state) or you generate new events. You don't have this selector thing.