mern-starter
mern-starter copied to clipboard
Upgrade to React Router (MERN 2.6)
Main thread related to upgrading to MERN 2.6 (react router 4)
@ashifa454 here is where we can track ongoing issues with React router upgrade (2.6)
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 .
can you guide me why we are using match
in server.js, what is the alternative for it in V4
@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
i am following the official docs and have resolved the match
thing, just trying to fix checksum, for server and client