0

I need to develop multiple react native projects which share common UI elements. I plan to create a UI component library and use it in all these apps. What would be the best way to import the RN library into my RN project?

1 Answers1

0

I think the cleanest way to go about it would be to publish the ui library to npm. Doing this would let you install and update the ui library the same way you would any other npm package.

e.g. if the npm package name is my-awesome-ui-components

  • Installing: npm i my-awesome-ui-components

  • Updating: npm update my-awesome-ui-components

  • Importing:

    import { Switch, Text, Button,  } from 'my-awesome-ui-components'
    
  • Here's a cool guide for getting started with publishing to npm.

  • Here's the npm docs on publishing privately (if thats what you need to do)

PhantomSpooks
  • 2,877
  • 2
  • 8
  • 13