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

Should react-router-dom be utilized on the server or is there a suitable replacement? #2

Open
deanrad opened this issue Jun 4, 2018 · 2 comments

Comments

@deanrad
Copy link

deanrad commented Jun 4, 2018

It raised an eyebrow to see a dependency on react-router-dom in the server/handlerRender.js file, since it's a client library being utilized on the server.

import { matchPath } from 'react-router-dom';

From Michael Jackson's guide you referenced: https://reacttraining.com/react-router/web/guides/server-rendering, there's a /server folder which might be more appropriate. As a code reviewer I'd be less concerned about the latter than the former..

import ReactDOMServer from 'react-dom/server'
@deanrad
Copy link
Author

deanrad commented Jun 4, 2018

Also - reading what I wrote I see the MJ example is for a different library, but I still have the question of whether its best practice to use matchPath on the server in that way.

Also FYI Im really glad you put this repo together and there are a few tweaks I'll be sending you in a PR of my thanks - let me know if you want me to do anything on this match-path thing!

@william-woodhead
Copy link
Owner

Yeah its an interesting one. I have actually lifted it directly from the react-router docs https://reacttraining.com/react-router/web/guides/server-rendering so I'm assuming they think its best practise.

I'll have a look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants