How do I return data from middleware? #10857
-
|
I want similar behavior for middleware like action and loader when I return data() // this code straight up throwing error like // this code works but bubble up to error boundary I don't want to blow up the UI with Error Boundary when the user click a button that fire Route's action(). |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
There is no middleware in Remix v2 For all React Router related questions, please open discussion on https://github.com/remix-run/react-router/discussions You don't return data from middleware, please review the React Router middleware documentation for more information and examples |
Beta Was this translation helpful? Give feedback.
-
|
Any alternative? |
Beta Was this translation helpful? Give feedback.
-
|
I was referring to alternatives for accessing the hash in the clientLoader.
Middleware could work, but since the fragment isn’t part of the request, I
assume it wouldn’t be available there either — unless I’m missing something?
…On Fri, Mar 20, 2026, 11:38 AM Sergio Xalambrí ***@***.***> wrote:
An alternative to what? The RR docs explains how to use middleware and
pass data from middleware to other middleware or loader/action functions
—
Reply to this email directly, view it on GitHub
<#10857?email_source=notifications&email_token=B72ORAXYOXYWK5R75TVCQCD4RVXXJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRSGI4TEMRUUZZGKYLTN5XKU43VMJZWG4TJMJSWJJLFOZSW45FMMZXW65DFOJPWG3DJMNVQ#discussioncomment-16229224>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B72ORAVPDTPB3XJDL3ETK7D4RVXXJAVCNFSM6AAAAACM57KGRKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMMRSHEZDENA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
There is no middleware in Remix v2
For all React Router related questions, please open discussion on https://github.com/remix-run/react-router/discussions
You don't return data from middleware, please review the React Router middleware documentation for more information and examples