there is something really horrifying happening in the glitchsoc frontend codebase

Follow

arrow functions which have `this.props` in their body

how does this site… function

· · Web · 3 · 0 · 1

god it doesn’t support `??` how outdated is this stack

@aescling legitimately i think this entire frontend is built on top of a jenga tower of outdated babel transforms which can never be updated

@alyssa it's very cursed imo for arrow functions to refer to `this` when they don't appear inside a different non-arrow function whose `this` they are inheriting, but this is apparently normal for React

@Lady @alyssa what is even the actual this context of all these arrow functions. is it supposed to be a reference to globalThis or something

@aescling @alyssa no, the arrow functions are being defined using = inside a class declaration, so the context is the constructed instance (instance fields are defined after the call to `super()` in the constructor iirc)

like

class Blah extends React.Component {
yep = () => {}
}

is doing

class Blah extends React.Component {
constructor() {
super()
this.yep = () => {}
}
}

@Lady @aescling oh yeah that's fucky. been a while since i looked at mastodon code i guess; i'd forgotten all of that.

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.