Hacker News new | ask | show | jobs
by dickjocke 2363 days ago
Can you really straight up share components between react and react-native? Most of the RN components kinda map to mobile stuff--they're called things like View and TextInput. Most of what I see in React are divs with different stylings.

Moreover, can you share any code at all between node.js and react/RN?

1 comments

We did that in one of our projects using react-native-web https://github.com/necolas/react-native-web which basically allows you to write your web code within the react native project so everything is shared between web and mobile including the same views which are exported for the web with proper styling as mobile. Plus it allows you to override any components for your web using .web.js just as .ios.js and .android.js extentions.