Is there a pre-built react component to edit arrays?
My Use Case: An array of members involved in a project.
Features needed:
- Adding users to the array
- Removing users from the array
- Keeping a minimum of 1 user in the array
What's up!
I don't think so, but you can do that things manually:
Add Anything to the array: array.push(user) - That thing add user to the last position
Removing user from the array: array.pop() - Remove the last element from array; Or array.filter(user => user.id !== id) - For example
You can't exactly keep one user, but you can do something like: if(array.lenght >= 1) {...code}