Skip to main content

安装依赖

生成的项目包括 React 和 ReactDOM 作为依赖。它还包括 Create React App 使用的一组脚本作为开发依赖。你可以使用 npm 安装其他依赖(例如 React Router):

¥The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with npm:

npm install --save react-router-dom

或者你可以使用 yarn

¥Alternatively you may use yarn:

yarn add react-router-dom

这适用于任何库,而不仅仅是 react-router-dom

¥This works for any library, not only react-router-dom.