🌍 React Native for Next.js Proof of Concept
This is a proof of concept repository for using React Native in a Next.js project.
The main focus is to explore the possibility of sharing components between web and native.
▶️ Walkthrough
- Take a look at the
UniversalComponent.js
component which is defined with only React Native primitives. - This component is then imported in
pages/index.js
(a normal Next.js page with DOM elements). - Start the app*:
npm install && npm start
- Open the app: http://localhost:3000
- You should see a working Next.js page with the universal component being rendered without issues. This universal component can be used in a React Native mobile app as well because it doesn't render any DOM elements. Now we can "Write once, run anywhere." 😎
*This repository's default branch is also deployed to universal-components.vercel.app