Skip to content Skip to sidebar Skip to footer

How Can Different Apps Import From A Shared Components Folder? React / React-native

I'm currently working on a project where we have to make 2 mobile apps. We decided to build those apps with react-native, so we can take advantage of the cross platform functionali

Solution 1:

If you want to share the components between two discrete projects, the common solution is to create your own NPM library as jmargolisvt suggests in their comment.

It will add a bit of overhead to publishing changes to your component library though. If you need to move fast, you can install you component library into your project by installing directly from Github for example. See NPM's docs for the npm install syntax for this: https://docs.npmjs.com/cli/install

Either way, your structure ends up look like the below, and you'll be able to import your shared components as you would any other npm module.

app-ios
  - depends on app-component-library
app-android
  - depends on app-component-library
app-component-library

Post a Comment for "How Can Different Apps Import From A Shared Components Folder? React / React-native"