Skip to content

Return dispatcher from useStateAction #190

Answered by TheEdoRan
adorkable77 asked this question in Q&A
Discussion options

You must be logged in to vote

Problem is that if users use dispatcher instead of execute, then input and status properties go out of sync, which is not a good DX, as already said above. Returning dispatcher from useStateAction would allow writing buggy code, and I already can see the number of issues that would be opened if I implemented that.
So, not sure if there's a good solution. If you want progressive enhancement, it's probably best to use the useActionState hook from React. Let me know your thoughts as well, thanks.

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
5 replies
@adorkable77
Comment options

@TheEdoRan
Comment options

Answer selected by adorkable77
@adorkable77
Comment options

@adorkable77
Comment options

@TheEdoRan
Comment options

Comment options

You must be logged in to vote
7 replies
@MrOxMasTer
Comment options

@TheEdoRan
Comment options

@MrOxMasTer
Comment options

@MrOxMasTer
Comment options

@MrOxMasTer
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants