2

I have forked and cloned ReactTraining/react-router and am wondering how I import my clone into another project.

Instead of:

import { Router } from 'react-router'
...

I want to do this:

import { Router } from './projects/react-router/packages/react-router'
...

Note, as seen above, all of my projects are under a directory called projects. If I am working in projects/react-tutorials, how do I import my /projects/react-router? Also, lets say I've made no changes so far to react-router, therefore it should be the same should it not?

DustinRW
  • 243
  • 2
  • 12

1 Answers1

0

One options is to use the forked package as npm dependency. Just add the forked library url path to the package.json like so:

{
  "dependencies": {
    "react-router": "https://github.com/<github-user-name>/react-router.git"
  }
}

and then just run: npm install.

you can see more examples here

and now you can import it

Community
  • 1
  • 1
Liron
  • 199
  • 1
  • 8