Yes you want the team to be visible immediately in the table, you would have a function called for example handleAdd
that will send a fetch request to add the team and then return the inserted row id, then you would insert that id along with other data in the state, the id is required if user want to edit or delete the item by id, then the table will be updated when you set the state, there is no need to call fetchTeams after add, only call it once as the initial data, so put it and call it inside useEffect
, the array of dependencies should be empty