4
msdsk
301d

Who the fuck thought that in react useState should return an array and not an object. It makes me wanna make a wrapper that would instead return {current, set} = useSaneState('fuck you') because what the fuck does it have to do with arrays. And an object with shit.current would be consistent with useRef.

Also, vue is just superior in naming and coding standards.

Comments
  • 0
    https://devrant.com/rants/7705194/...

    See last comment here.

    const object = ...

    is not the same as a destructured variable, as the object is not immutable.
  • 0
    @IntrusionCM
    I understand the idea behind the setter and the immutability but I simply think it's inelegant to handle it this way. JS objects can have proper setters, we don't need to reinvent a wheel (and patterns) here. Look at Vue, you initialize an object and then you can "directly" manipulate its .value. For me it feels like a design decision from somebody who started to work around the beginning around es 2015 and just thinks that restructuring is the end of it all.
  • 0
    I always make the mistake of using {} like why is it an array
  • 1
    @ostream let me guess u probably never tried it
  • 1
    @ostream not OO , vue
  • 0
    @ostream
    Yeah but JavaScript doesn't have tuples.
Add Comment