-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
MDN React tutorials #1: Getting started #30177
Conversation
Preview URLs External URLs (11)URL:
(comment last updated: 2023-12-21 10:50:54) |
Hi @mxmason, nice to see you on here! So, we don't really have staging for MDN content; we just work off of a fork taken from main, and then merge it in. You will notice that the environment auto-generates preview URLs so we can see what the rendered content looks like without having to build the branch locally and render it: #30177 (comment) In terms of process for this work, there are no hard and fast rules, but I'm happy to figure out a process that works for the both of us. Historically I have generally worked with single giant PRs for my changes, but that is changing, as reviewers tend to find that unwieldy, plus it takes longer to produce the first draft to review. One system that has worked in the past (which I did for the WebGPU reference docs) is to:
Would this work for you? The disadvantage here is that it is harder to check whether each subsequent page is consistent with the ones that came before. You just need to have the preview pages from the previous PRs open in separate tabs to refer to as you review each one. But, it is OK. Or we could do a kind of hybrid approach, where either you do a couple of pages per PR, and/or maybe merge each approved PR into the next PR in the sequence as it is approved. What option do you prefer? Or do you have another idea? |
Hello, @chrisdavidmills! 💜 Thanks for explaining our options. I figured you might not have a staging branch, but I thought I should ask. If it works for you, could we do an approach in which this branch (or a new one, I'm not fussed) is the trunk for all our content changes, and we merge subsequent PRs into it? Would your CI tools build previews for those, or does it only build if the PR is based on One example of what I'm thinking:
Does that make sense/is it doable? It sounds kind of like your final suggestion, but I wanna be super sure I understand :) |
Sure, this sounds good to me. As far as I know, the CI tools should build previews for all of those, yes.
Yes, this sounds good to me. Let's do it! |
Hello, @chrisdavidmills! I've done broad edits of this whole page, so I think we're ready for a review. The content in this file hits the same points as before, with the largest changes being related to Vite, and the fact that Vite provides different boilerplate than create-react-app does. Some questions:
|
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.
Ok, that'll do for now for my first review. Quite a few comments here @mxmason, but barring a couple, nothing serious and mostly just grammar/language suggestions.
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
@mxmason and some responses to your questions:
I think it Is fine. It really isn't very much boilerplate, and I think it is useful to give the reader the experience of using the command line and delving into the code. Plus, if we created a template repo we'd have to decide where to put it, and that would create another thing we have to maintain.
Yup, capture away ;-)
No, we don't use line numbers anymore. Old Kuma MDN used to do this, but I'm not sure if yari does. Also, I seem to remember line numbers being a pain because you'd inevitably change the code example, then have to remember to update all the line number references to suit. Absolute pain. Also, if your code blocks are big enough that you need line numbers to help readers navigate them, they are really too big. |
Co-authored-by: Chris Mills <[email protected]>
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.
Once again to you, @chrisdavidmills
The **`src`** directory is where we'll spend most of our time, as it's where the source code for our application lives. You'll notice that JavaScript files in this directory end in the extension `.jsx`. This extension is necessary for any file that contains JSX – it tells Vite to turn the JSX syntax into JavaScript that your browser can understand. The `src/assets` directory contains the React logo you saw in the browser. | ||
|
||
The `package.json` and `package-lock.json` files contain metadata about our project. These files are not unique to React applications: Vite populated `package.json` for us, and npm created `package-lock.json` for when we installed the app's dependencies. You don't need to understand these files at all to complete this tutorial. However, if you'd like to learn more about them, you can read about [`package.json`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json/) and [`package-lock.json`](https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json) in the npm docs. We also talk about `package.json` in our [Package management basics](/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Package_management) tutorial. |
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.
These paragraphs are a little more complete. I mention the assets
directory within src
and acknowledge the package.json
lockfile, with some links.
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.
Looking good.
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Show resolved
Hide resolved
...-us/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.md
Outdated
Show resolved
Hide resolved
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.
@mxmason LGTM! Ready to go on to the next one ;-)
Let me know if you need me to do anything to get the process set up for the next stage.
So, @chrisdavidmills: I think we have hit an impasse with my proposed strategy for managing PRs: if I use this branch as a base for a new PR, the pull request will be opened against my fork, not against MDN's repo – you can see this here. Can you create some kind of Whatever you'd like to do, that branch is basically ready for you to look at! |
OK, so here is a thought. We could do the same thing as I have been doing for my Google MDN work, in which I get the technical review done in one PR, then close that PR and open another one based on the same branch to do the editorial review in. So, each time one of your new articles is reviewed and approved, I close the PR, open another one based on the same branch, and you carry on your work in that for the next article. Each PR would only contain the comments for a single article, saving all the confusion of having all comments in one PR. What do you think? |
Oh, I like that! I've never really worked on a branch after closing a PR so this wouldn't have crossed my mind. Let's do it! |
Great, I'll set this up then. I'll close this and create a fresh PR for you to continue working in. |
create-react-app
with Vitecreate-react-app
with Vite in React tutorials #1
OK, scratch that. For some reason, your fork won't show up in the list of forks to compare against when I try to create a new PR based on it. I can't figure out why. This is really annoying. So how about you create a new fork based on mdn/content and do the second article update in it (or more if it ends up being a small update), and then we'll keep this one open, and make a note on each subsequent one to not merge it until the previous one has been merged. Each time we merge one we'll update the next one against the base branch and make sure there are no conflicts before merging it, etc.? |
Terrible of GitHub to do this to us! Your suggestion works for me. I'll realign my branch with main and open a PR in a few. |
create-react-app
with Vite in React tutorials #1
This pull request has merge conflicts that must be resolved before it can be merged. |
* chore: replace create-react-app with vite * chore: .js --> .jsx * chore: add dev script section * chore: update App component walkthrough * fix: use correct h1 link * feat: rewrite more * chore: apply suggestions from review Co-authored-by: Chris Mills <[email protected]> * chore: fix npm script syntax * chore: rewrite node install instructions * chore: delete extraneous section * chore: delete image from replacement code * chore: add syntax explainer * chore: clean up final section * chore: rewrite jsx section * chore: nitpick notes * chore: delete React 17 note * chore(nit): hard drive -> machine * chore: apply suggestions from code review Co-authored-by: Chris Mills <[email protected]> * remove superfluous quote * chore: replace create-react-app image with vite * chore: index.jsx --> main.jsx * chore: clean up prop-comment section * chore: delete note on multi-word attributes * chore: use code syntax in heading * chore: change npm script note * chore: update note again * chore: fix image alt * chore: apply suggestions from code review Co-authored-by: Chris Mills <[email protected]> * chore: replace rollup mention with generic bundler reference * chore: document assets directory * chore: document lockfile * chore: disambiguate app function and component * chore: add some * Small App() related tweaks --------- Co-authored-by: Chris Mills <[email protected]>
Description
This set of PRs is intended to update the MDN learning area React tutorials to use Vite instead of
create-react-app
, and make sure that any other React/JSX code uses up-to-date best practices.Refer to the task list at mdn/mdn#474 to see the overall completion status of each tutorial.
Fixes mdn/mdn#474
When all of these PRs are complete, merge this one first.