Summary:
This is the next step toward full support for async form actions.
Errors thrown inside form actions should cause the form to re-render and
throw the error so it can be captured by an error boundary. The behavior
is the same if the `<form />` had an internal useTransition hook, which
is pretty much exactly how we implement it, too.
The first time an action is called, the form's HostComponent is
"upgraded" to become stateful, by lazily mounting a list of hooks. The
rest of the implementation for function components can be shared.
Because the error handling behavior added in this commit is just using
useTransition under-the-hood, it also handles pending states, too.
However, this pending state can't be observed until we add a new hook
for that purpose. I'll add this next.
DiffTrain build for commit fd3fb8e3c5.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238266
Pulled By: kassens
fbshipit-source-id: 93fe8581172522f955278918bf97a0eb54daeeed