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?
Asked
Active
Viewed 141 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 19 '21 at 01:23
1 Answers
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