mern-starter icon indicating copy to clipboard operation
mern-starter copied to clipboard

Upgrade to React Router (MERN 2.6)

Open mannyhenri opened this issue 6 years ago • 6 comments

Main thread related to upgrading to MERN 2.6 (react router 4)

mannyhenri avatar Oct 15 '18 04:10 mannyhenri

@ashifa454 here is where we can track ongoing issues with React router upgrade (2.6)

mannyhenri avatar Oct 15 '18 04:10 mannyhenri

Ok, i am going to continue from today. Was kinda stuck at companies deployment.

On Mon, Oct 15, 2018 at 9:41 AM Manny Henri [email protected] wrote:

@ashifa454 https://github.com/ashifa454 here is where we can track ongoing issues with React router upgrade (2.6)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Hashnode/mern-starter/issues/399#issuecomment-429703017, or mute the thread https://github.com/notifications/unsubscribe-auth/AM_eU1KynY5b2zuZxoPE4PQkMpOALeHUks5ulArugaJpZM4Xbji5 .

ashifa454 avatar Oct 15 '18 04:10 ashifa454

can you guide me why we are using match in server.js, what is the alternative for it in V4

ashifa454 avatar Oct 17 '18 15:10 ashifa454

@ashifa454 I don't believe there's a direct equivalent for match on the server. We'll have to use a <StaticRouter /> and pass in context and location, then after calling renderToString() we can check for context.url and handle redirects that way.

I'm not completely sure about errors, but I'm guessing wrapping the whole thing in a try-catch or Promise should suffice for handling render errors.

You can read a bit more about it here: https://reacttraining.com/react-router/web/guides/server-rendering

mattlubner avatar Oct 17 '18 17:10 mattlubner

i am following the official docs and have resolved the match thing, just trying to fix checksum, for server and client

ashifa454 avatar Oct 17 '18 17:10 ashifa454