hassanzohdy / react-router

A Simple powerful react router system
5 stars 1 forks source link

Returning any value in middleware refer to stop execution in middleware cycle. #5

Closed KariMuhammad closed 1 month ago

KariMuhammad commented 2 months ago

I see any return statement in middlewares refer to stop execution in the middleware cycle and that causes a lot of confusion for readers about the code.

so I think it will be good if middleware does not return anything if middleware goes forward for the next middleware or calling the next() function to refer to the calling next middleware.

I think it will make code reading more clear.

hassanzohdy commented 2 months ago

I see it is unnecessary complications, If you want to stop continue the route workflow, just return the value or navigate to other page, other than that, what value will be given when using next() concept than current flow?