This is a simple step-by-step manual on how to share logic between a React app created by CRA and a React Native app. In order to do this, we are going to use a tool for managing multiple JavaScript packages called Lerna.
We should have this structure in the folder:
You have to run the command "yarn" in the root file, Lerna will install all the dependencies for the project in the folder packages
To test in web:
To test mobile app in Android:
To test mobile app in iOS:
In this example, my shared library is going to be referenced by the name "@root/shared"
To do this, I have to add this dependency in the "package.json"
Create "packages/NativeApp/metro.config.js" with the following contents:
Ready to get started? Use the form or give us a call to meet our team and discuss your project and business goals.
We can’t wait to meet you!
Call us!
+1 (347) 871 09 22
Write to us!
info@vairix.com