如何从我的 GitHub 帐户导入 React 应用,作为新 React 应用的组件?
例如,我构建了 NavBar
的 React 应用程序并将其上传到 GitHub。我想将此 NavBar
应用程序作为组件导入到新 React 项目的 header 组件中。
最佳答案
试试这个:
npm install git://github.com/username/repo.git#branch-name
yarn add git://github.com/username/repo.git#branch-name
// Example
yarn add git://github.com/denvash/react-pagination-example.git#master
然后根据repo路径导入,例如:
import Pagination from 'react-pagination/src/components/Pagination.react'
关于reactjs - 如何将react应用程序从GitHub作为组件导入到新的react应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57256576/