Does <Await /> have to be a component? #9271
Unanswered
rubber-duck-software
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on adopting the new 6.4 data loading apis. I've been excited about this for months. As I'm adopting it, I have found one page which should use deferred data loading, but the component is a bit awkward for this page's needs. Would it break 6.4s loading model if I instead wrote a useAwait hook? The hook would work as follows: throws unresolved promise, throws rejected promise result, else returns resolved promise result. This could be implemented using the same "TrackedPromise" mechanism ReactRouter uses. Is there a reason I shouldn't use this? Could this be a helper provided by react router?
Just getting started with 6.4. Any help would be appreciated.
As an example of doing this as a hook, it might be:
Beta Was this translation helpful? Give feedback.
All reactions