this post was submitted on 18 Jun 2023
12 points (100.0% liked)
React
935 readers
1 users here now
A community for discussing anything related to the React UI framework and it's ecosystem.
Wormhole
Icon base by Skoll under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
No diff with typescript, tho declared is more flexible because you can overload it. Declared (classic) functions are hoisted and can be used prior to their declaration. Not sure on perf differences
I was doing some research and it seems like arrow function preserves 'this' context. Might be a reason to either classic or arrow. The overloading seems like a valuable option too.
Good call. Yah overloading is the way to go for complex function signatures in typescript