How do I share components between react and react-native? #2397
-
I want to share UI components between react and react native. So I create a UI components project by react-native-web and I want to compile the project as a UI library which used in both react and react-native projects. How can I achieve the target? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Sure you can. React-native-web make it happen. I already build a tiny universal ui components library with styled-system https://snowbox.js.org/ |
Beta Was this translation helpful? Give feedback.
-
react-native-web is a web implementation of most of the react-native API. The documentation describes how it should be used as a package alias for |
Beta Was this translation helpful? Give feedback.
react-native-web is a web implementation of most of the react-native API. The documentation describes how it should be used as a package alias for
react-native
when bundling apps for the web. To create a cross-platform UI library, you can use thereact-native
package and API in the components, and then usereact-native-web
package aliasing to bundle the UI library for web.