Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add instructions to create pages directory and add an index.js file to it #35971
Add instructions to create pages directory and add an index.js file to it #35971
Changes from 9 commits
9d52d6e
93485f0
2ce161a
bbee0f5
ecd32f0
dbbe969
a47729c
ff3107f
8d00bb9
559dae2
6b11479
5bbb587
3572fc8
f68ce2f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say something about converting
public/index.html
topages/index.js
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do that on line
54
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think line 54 is a bit confusing because its saying "create an index.js file" but CRA already has an index file so I think renaming/converting is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I'll change the instruction to say that move the
index.js
file topages
directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot how CRA is formatted so I just did
npx create-react-app@latest
and here's what I found:src/index.js
seems to be similar to Next.jspages/_document.js
src/App.js
seems to similar to Next.jspages/index.js
public/index.html
seems to be similar to Next.jspages/_document.js
or perhaps a layout inpages/_app.js
The problem I'm finding is that CRA doesn't come with a router so its almost impossible to give clear instructions here since only the user understand their own CRA application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To tackle the problem of routing, I think we do mention that Next.js has a file system based routing and provide a link for the developer to go through the link and also a link for migrating from react-router.
If we want to add conceptual information by explaining how routing works with Next.js and things they might need to go through when migrating, then we can add more information to the guide and provide basic code snippets (or not). I am not sure how Next.js team feels about adding in-depth information in this guide.