Lets say I have a list in react jsx
<ul>
<li>stuff</>
<li>stuff</>
<li>stuff</>
<li>stuff</>
<li>stuff</>
</ul>
How would I select one of the list items? I don't mean on the client side in the case I could just attach a click listener. But lets say I get a message from the server that I need to do something with the third item on the list. What I have been doing until now is setting the list items as state and then for example if I want to delete the middle item I simply update the state with a new list that doesn't include the middle item. The problem with this is that if the list is huge it seems bad practice to be constantly deleting and recreating a huge list, or perhaps maybe I don't want to delete/add any list items but do something like add some text or animation to a specific list item.
from Select list item in react, not from client side
No comments:
Post a Comment