4 ms·
So instead of ’const tubeStations = useDatasource()’ we now type ’<DataSource id=”tubeStations” />’ and anything beyond this basic example is left as exercise f
by Too 1y ago
So instead of ’const tubeStations = useDatasource()’ we now type ’<DataSource id=”tubeStations” />’ and anything beyond this basic example is left as exercise for the reader.
Doesn’t seem like a big improvement? In fact the opposite. Sure, React’s stateful hooks mixing in a semi-declarative mode of programming in otherwise imperative code isn’t exactly intuitive, but the flexibility and familiarity you get from having full JavaScript at your fingertips is worth everything. Hands up anyone who want to learn how to make a for-loop with filter+map in xml syntax. Didn’t think so.
If you want to fix react what you should do instead is keep jsx and give stateful hooks a dedicated section that can’t be mixed up in rendering code.
- deleted 1y ago[deleted]
- ricardobeat 1y agoYou're forgetting the state management required to link the components. Here's a take (by Claude) on what it would look like, even if you ignore the entire `useDataSource` implementation it's an entirely different beast: https://gist.github.com/ricardobeat/8aedb9c6d3a1b0bfaba9cc55d9393e48 https://gist.github.com/ricardobeat/8aedb9c6d3a1b0bfaba9cc55...
- judell 1y ago> exercise for the reader The demo app shows a bunch of patterns. https://docs.xmlui.org/tutorial-01 https://docs.xmlui.org/tutorial-01