4 ms·
After making some simple <If> <Loop object="">, etc custom components.... I've wondered why they don't exist in react by default, or arent the common pattern.
by jmcdiesel 10y ago
After making some simple <If> <Loop object="">, etc custom components.... I've wondered why they don't exist in react by default, or arent the common pattern.
They are very readable... maybe people just dont like the "logic" in a tag... i guess... whatever, made for some really readable code...
- jetter 10y agoRegarding <If> component - here is the guy that suggested this and then admitted that this is a bad approach in a long run: http://stackoverflow.com/a/26152067/1132016 http://stackoverflow.com/a/26152067/1132016
- straye 10y agoUsing <If> combines the worst aspects of custom SGML template markup languages and the complexity of React but with additional runtime overhead.
- natmaster 10y agoTurns out javascript is a quite reasonable language and already does that great.
- madeofpalk 10y agoI would rather 'regular' JS functions like .map() rather than React-specific functions like <If> and <Loop> (not to mention the namespace clash with existing JS keywords)