But it has a trouble problem that in TS: the item needs to define a variable separately to match the TS type.
I feel that the approach of react-loops, which maybe has a higher recognition, because it uses the render props pattern commonly used in React. For example, solidjs also uses this <For> design: solidjs.com/docs/latest/api#%3Cfor%3E
After reading your article, I think it's certainly useful. I just feel that at first glance, there is a lot of code, which is a little complex for people who see it for the first time, perhaps it would be better to have a simplified version. Thanks for sharing~
I mean, you would have the actual function in a utilities file and it's only a few lines of code. It works fine in TS. Here's an example of Repeat written that way.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh, I basically understand, thanks for your detailed reply.
For the approach without render function, I also have seen this: github.com/AlexGilleran/jsx-contro...
But it has a trouble problem that in TS: the
item
needs to define a variable separately to match the TS type.I feel that the approach of
react-loops
, which maybe has a higher recognition, because it uses therender props pattern
commonly used in React. For example,solidjs
also uses this<For>
design: solidjs.com/docs/latest/api#%3Cfor%3EAfter reading your article, I think it's certainly useful. I just feel that at first glance, there is a lot of code, which is a little complex for people who see it for the first time, perhaps it would be better to have a simplified version. Thanks for sharing~
I mean, you would have the actual function in a utilities file and it's only a few lines of code. It works fine in TS. Here's an example of Repeat written that way.