redirect - react-router navigate to external url -


i'm on react-router@3.0.0-alpha.2 using onenter hook on route , attempting redirect user external url (outside of app). i'd on server side. noticed match function callback has redirect location appears route within app. there way redirect users website entirely?

since user leaving app, it's not related react-router.

if you're using express, call res.redirect() (which defaults 302) within route/middleware want trigger redirect.

something like:

app.get('/go-elsewhere', (req, res) => {   res.redirect('http://elsewhere.com'); }); 

(untested, hope that's right)


Comments