Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Router ? #4243

Closed
HamidReazaNikoonia opened this issue May 1, 2018 · 6 comments
Closed

React Router ? #4243

HamidReazaNikoonia opened this issue May 1, 2018 · 6 comments

Comments

@HamidReazaNikoonia
Copy link

i have simple question , i am new in Next.JS we have a project and my web application manage routes in BackEnd with Next JS

now my problem is here , i want use React-Router-dom in one section

forexample before im working with Laravel and React

in Laravel I set My Route like This

Route::get('/reactPage/*' ...)
and then use Clien route with react

but i dont know how handle this with Next JS

( more details => for example i want user click to some link after that user see a page with some link inside of them , if user click that link , react-router-dom handle route and no any request send to Server )

@Kyle-Mendes
Copy link

Kyle-Mendes commented May 1, 2018

You don't need react-router at all with Next.

Next comes with it's own routing solution, and all routing can be handled by that.

Sounds like you might want to use the Link component.

import Link from 'next/link';

//...
render( 
  <Link href="/my-page">Go to my page</Link>
);

This will do a client-side route push to /my-page.

@sergiodxa
Copy link
Contributor

sergiodxa commented May 1, 2018

There is a discussion about React Router already happening on #1632, I recommend you to check it.

Note with Next.js your Laravel app should be an API and routing (either client and server side) should be handled by Next.js.

@ghost
Copy link

ghost commented Jul 13, 2018

For anyone who needs a temporary solution, I've tried next-react-router found at npm. And it works fine for me.

@egemon
Copy link

egemon commented Oct 5, 2018

@EchoC1 how did u use it without docs?

@Hocoh
Copy link

Hocoh commented Feb 18, 2019

You don't need react-router at all with Next.

@Kyle-Mendes I understand you, maybe if you want to make page-transition animation, specifically on nested components should, react-router with react-transition-group come handy

@ghost
Copy link

ghost commented Apr 1, 2019

I am using next.js but with next js i can't redirect pages based on login Router.push('/') works only on components. I want Redirect component but in next js Link is there

@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants