3 ms·
How anyone finds this code maintainable is beyond me: https://github.com/ant-design/ant-design/blob/master/components/table/InternalTable.tsx https://github.com
by klaussilveira 2y ago
How anyone finds this code maintainable is beyond me: https://github.com/ant-design/ant-design/blob/master/components/table/InternalTable.tsx https://github.com/ant-design/ant-design/blob/master/compone...
- totaa 2y agotable components are typically the most complex. this is cleaner: https://github.com/ant-design/ant-design/blob/master/components/alert/Alert.tsx https://github.com/ant-design/ant-design/blob/master/compone...
- lghh 2y agoI'm not sure anyone does.
- solardev 2y agoWhat's particularly wrong with it? Looks like pretty standard React, with some custom hooks imported, and clearly defined props. If you start at the bottom, with the actual component (https://github.com/ant-design/ant-design/blob/master/components/table/InternalTable.tsx#L583-L615 https://github.com/ant-design/ant-design/blob/master/compone...), the logic is much clearer. Most of the other consts are just definitions that you pass to the component (see documentation at https://ant.design/components/table#table https://ant.design/components/table#table). And for the long list of imports and such, any modern IDE can parse those for you and easily jump to the source or the type defs. If you're complaining about how this looks vs traditional OOP code, etc., that's just a stylistic choice Meta made for React codebases a few years back. It actually does make components pretty easy to maintain over the long term because all the core logic is just in one long, flat file. Lots of vertical scrolling, but predictable outcomes and easily refactored chunks. But third parties typically just have to mimic that style. That's not on Ant, that's just how JS code is currently in fashion...
- agumonkey 2y agoIt's long but it's not bad imo.
- hombre_fatal 2y agoCompared to what? It's a complex component that doesn't get any simpler if you change UI platforms. And while complex, it's not hard to follow. Here's the source of DataTables: https://github.com/DataTables/DataTablesSrc https://github.com/DataTables/DataTablesSrc (https://datatables.net/ https://datatables.net/)
- klaussilveira 2y agoCompared to any major UI library out there. Take QT for example: https://github.com/qt/qtbase/blob/5d1ded3359ee8bffa33a4b83d5e72b855d61dcc2/src/widgets/itemviews/qtablewidget.cpp https://github.com/qt/qtbase/blob/5d1ded3359ee8bffa33a4b83d5... That ANT Table is not complex. QT has tons of legacy and supports way more features, yet, code is easier to grasp and maintain. Also, C# and WinForms, if you don't like C++: https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/DataGridView.cs https://referencesource.microsoft.com/#System.Windows.Forms/...
- deleted 2y ago[deleted]
- hombre_fatal 2y agoThis just seems like a comparison of how familiar you are with any of the UI libraries. None of these are simple. You're linking me thousands of lines of code, 6000+ in the WinForms example. Yet the Ant link is just 600 lines.