mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
React — documentation site
Getting started
Prerequisites
- Git
- Node: install version 7.6 or greater
- Yarn:
npm i -g yarnto install it globally via NPM - A clone of the React repo on your local machine
- A fork of the repo (for any contributions)
Installation
cd reactto go into the project rootyarnto install the main NPM dependenciescd wwwto go into the website projectyarnto install the website's NPM dependencies
Running locally
yarn devto start the hot-reloading development server powered by Gatsbyopen http://localhost:8000to open the site in your favourite browser
Contributing
Create a branch
git checkout masterfrom any folder in your local react repositorygit pull origin masterto ensure you have the latest main codegit checkout -b wwwTheNameOfMyChange(replacingTheNameOfMyChangewith a suitable name) to create a branch
Make the change
- Follow the "Running locally" instructions
- Save the files and check in the browser
- Any React components in
src/componentsorsrc/templateswill hot-reload - If working with plugins, you may need to remove the
.cachedirectory and restart the server
Test the change
- If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
- Run
yarn prettier-all && yarn lintfrom the project root (outside ofwww)
Push it
git add -A && git commit -m "My message"(replacingMy messagewith a commit message, such asFixed header logo on Android) to stage and commit your changesgit push yourname wwwTheNameOfMyChange- Go to the React repo and you should see recently pushed branches.
- ... follow GitHub's instructions...
- If possible, include any screenshots of visual changes. A Netlify build will also be automatically created once you make your PR, so other people can see your change.
Troubleshooting
yarn resetto clear the local cache