Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use react j s components in react native app?

Is it possible to use all the reactjs components in react native app?If no,what is the best way to switch between react js and react native?

If an app is done using react js is it necessary(Compulsory) to use redux in that?

like image 666
Subramaniyan Narayanan Avatar asked Jun 20 '16 05:06

Subramaniyan Narayanan


2 Answers

There are two main points:

1.The base UI components in React (DOM) and React Native are different.

2.The ‘React’ objects in React and React Native are different (React Native removes the DOM-specific stuff adds a lot of native-specific code).

please check this link for more details:

https://medium.com/@aakashns/sharing-components-between-react-and-react-native-f6ce3713658a#.oa4my8p36

like image 187
Muhammad Shoaib Riaz Avatar answered Oct 12 '22 20:10

Muhammad Shoaib Riaz


I avoid these types of quests because React JS UI components built for the web have different semantics than React JS UI components built for React Native.

React Native doesn't have <div/> or <img/> or a DOM for that matter.

React Native uses React JS components that bind to native views, and things like CSS are so very different than that from the Web.

The only way you'd be able to use a React JS UI component in a React Native app is by making it 100% of the height and width of an embedded webview. It's possible (i've done it for testing purposes), but not ideal.

like image 5
JayGarcia Avatar answered Oct 12 '22 20:10

JayGarcia