Skip to content
Discussion options

You must be logged in to vote

“coupling / clear / predictable”

  • useActionState gives you one input channel (the “payload” you pass to action(payload)).
  • If you want that channel to carry both FormData and commands (RESET), you need a way to discriminate (type check, tagged union, separate function, etc.).

I wouldn't say that's "coupling", it is just what reducers are made for, transforming data given a new action, and for that certain logic per action is necessary.

And if we are gonna bring in coupling here, I think we can agree that, a reducer that handles:

  • SUBMIT with FormData
  • RESET with no payload

is less coupled than pushing reset responsibility up into parents via key-rotation, because of the reasons given ab…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Mohamed-maher50
Comment options

Comment options

You must be logged in to vote
2 replies
@Mohamed-maher50
Comment options

@icyJoseph
Comment options

Answer selected by Mohamed-maher50
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
Help
Labels
None yet
3 participants