I am working on a small Svelte application, for learning purposes (Im new to Svelte).
The application displays a JSON of users from randomuser.me API in a Bootstrap 4 table.
I have this deleteUser() method
const deleteUser = (uid) => {
let itemIdx = filteredUsers.findIndex(x => x.id == uid);
filteredUsers.splice(itemIdx,1);
filteredUsers = filteredUsers;
}
I want to add an upwards animation similar to the one jQuery's slideUp() provides.
Adding this fly transition on the table row <tr transition:fly="{{y:-100, duration:200}}"> does not get the desired result (although the effect I got is beautiful), as it is visible in this REPL.
There's 2 steps need to be done
add
(user)at the end of{#each-- so the loop associate the generated element with theuserobject on respective loopreplace
deleteUser(user.id)withdeleteUser(user)and update the implementation -- bugfix because user doesn't have id?so the end code would be something like this:
Have a look to the REPL.