Search code examples
reactjsreact-nativelernayarn-workspaces

Share common React Native components across multiple apps


I'm going to have 2 separate React Apps in a single lerna/yarn workspaces repo which will need to use the same components.

What's the best way to reuse these components in multiple application without publishing it to a separate private NPM package?


Solution

  • Locally

    You could install the dependency from a local folder.

    npm install /path

    https://stackoverflow.com/a/26028854/5508175

    From a github repo

    It is also possible to install from a GitHub repo

    npm install --save username/repo#branch-name

    https://link.medium.com/XYBpwAdRZS