Home > Enterprise >  React TS Is there a better way to render a list of elements and passing down useState?
React TS Is there a better way to render a list of elements and passing down useState?

Time:11-29

Code Sample

What I'm trying to do is render a list with a few elements and have a counter on the root element which i want to update every time one of the button is clicked But I'm not sure this is the best way, i'm coming from Blazor and i had some difficulties on rendering N elements, in c# we would do a for loop directly on the html. I get back the button text just to try that out i know i have the button text on the line before in the loop.

CodePudding user response:

Here is the improved way you may need.

  • Related