I built a similar library a little while back
MJez29 opened this issue Β· comments
Hey π
Funny enough, I built a similar library for writing loops in JSX a few months ago: https://github.com/MJez29/react-for. I was wondering if you had any thoughts on my implementation vs your version π
Thanks π
Awesome! Your implementation looks pretty good, really similar unsurprisingly! Seems like the only substantial differences are the slightly different API approaches and how to handle error cases.
I'll add your project to the list in the README!
Also, I'm curious how much your C-style For loop and While/Do-White component variants ended up being used in practice? I haven't seen those patterns very often, so I had omitted them here
Also, @MJez29 - do you have an email or what's the best way to PM? Feel free to email me at lee@leebyron.com if you don't want to post PM channel in the open
I don't really see that many use cases for For
, While
or DoWhile
. I mainly added them just so that my library would support all native JavaScript looping constructs.
The only case I could see For
being useful would be if you need the index when looping (which your library already handles) or when you have to render a component a set number of times rather than looping through a collection.
The one case where I could see a While
being handy would be if you have to iterate through a linked list although I'm not sure how common those are in React apps π
.
Tbh the do while
loop that I wrote for the library is probably the first one I've written in years π