igormcsouza / full-stack-todo

Full Stack Todo is a Project to show up my habilites and also, provide some snippets and other pieces and bobs very useful when developing your own projects
https://igormcsouza.github.io/full-stack-todo/
1 stars 0 forks source link

Just can't make async function work on useReducer #15

Closed igormcsouza closed 3 years ago

igormcsouza commented 3 years ago

I'm trying to populate the tasklist from the backend information fetching it as soon as the application starts. I also want to update it everytime an change is made on backend (when add, update or delete tasks).

I tried to use useEffect, but the Promise mess everything up.

I'm running out of ideas and this problem is driving me crazy! haha... :) I really would like to know what I can do to overcome it!

igormcsouza commented 3 years ago

Open stackoverflow question https://stackoverflow.com/questions/65876577/usereducer-typescript-on-a-async-maner

igormcsouza commented 3 years ago

Added new question on StackOverFlow

https://stackoverflow.com/questions/65968229/dispatch-from-usereducer-not-working-as-i-wanted

igormcsouza commented 3 years ago

Fixed!! Finally! I took all the async/await things to be done outside the reducer, and on the reducer, I just trigger the populate!