#React prop handling

18 messages · Page 1 of 1 (latest)

novel swanBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

wraith oxide
#

What's removeTask

royal hatch
#

oh shit SORRY

wraith oxide
#

Btw just to check, you are aware right you have opted out of nextjs and it's fetching behaviours right?

royal hatch
#
    function removeTask(id) {
        let tempTasks = tasks
        let removeIndex = tempTasks.map(item => item.id).indexOf(id)
        tempTasks = tempTasks.splice(removeIndex, 1)
        setTasks(tempTasks)
        console.log(tasks)
    }

Its really messy, im weak in js

wraith oxide
# royal hatch what? can you explain

So basically nextjs caching is server side,doing an axiis fetch in a use effect is how you would fetch on the client side, just wanted to let you know.. it's fine if that's expected

royal hatch
#

oh... i just realized.. so should i use fetch api? like how its defined in the docs?

wraith oxide
wraith oxide
#

Check out the docs since there is a lot of details there about fetching

#

Also

#

The reason it's not working is you aren't awaiting the handle deletion in the onclick

royal hatch
#

yes i got it working thank you so much!

novel swanBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1223641900712595556 message)

tulip raft
#

@royal hatch please dont delete the original question, [mark the answer](#1223641900712595556 message) instead. if Arinji's answer didn't help you fully, please also explicitly state so before deleting your question (it's alright, you won't be judged for saying an answer didn't help)

novel swanBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1223641900712595556 message)

novel swanBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1223641900712595556 message)