# react-first-game **Repository Path**: zgxtech_admin/react-first-game ## Basic Information - **Project Name**: react-first-game - **Description**: 通过创建一个在线五子棋游戏演示完整的React程序结构的构成内容及开发、编译、调试、测试过程和所需工具、命令。 - **Primary Language**: NodeJS - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-09-08 - **Last Updated**: 2022-06-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: React ## README # ReadMe 这个项目用于演示一个典型的React应用程序的结构,包含的文件类型。以及说明如何创建、开发、调试、运行、测试它。 > 这个项目是通过[Create React App](https://github.com/facebook/create-react-app)引导创建出来的。 ## 先决条件 首先你需要确认你的电脑中已经安装了nodejs相关组件及npm。默认情况下,npm自带npx命令。 如果没有安装,可以通过一下命令安装npx。 ~~~bash $ npm install -g npx ~~~ ## 通过create-react-app引导创建程序目录及内容 ~~~bash $ npx create-react-app my-app ~~~ - my-app: 是项目的名称,你可以根据你的喜好为项目去一个名字。 - 以上命令将会在命令所运行的目录中创建一个名为my-app目录,并生产一个典型react程序所需的所有必要文件。 稍后,你可以一下命令运行程序。 ~~~ $ cd [your project name] $ npm start //这将启动项目。 ~~~ 如果一切顺利,你将看到一下信息,并看到浏览器被启动,并自动打开本地调试网址。 --- Compiled successfully! You can now view first-game in the browser. Local: http://localhost:3000/ On Your Network: http://192.168.31.214:3000/ Note that the development build is not optimized. To create a production build, use yarn build. --- ## 项目结构 ``` my-app │ yarn.lock // 使用yarn方式管理程序,它才有用 │ README.md │ package.json // 程序包配置 │ pakcage-lock.json // 程序依赖的第三方包 | LICENSE | .gitignore └───src │ │ App.css │ │ App.js │ │ App.test.js │ │ index.js │ │ logo.svg │ │ serviceWorker.js │ │ │ └───components │ └───Game │ │ │ Board.jsx │ │ │ Game.css │ │ │ Game.jsx │ │ │ Square.jsx │ │ │ ... └───node_modules │ │ │ │ ... └───public │ │ │ │ ... ``` ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting ### Analyzing the Bundle Size This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size ### Making a Progressive Web App This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app ### Advanced Configuration This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration ### Deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment ### `npm run build` fails to minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify