Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use reactJS library in react-native?

Well, this might be a silly question but I want to clarify the reason. React-Native imports nodeJS libraries, so I think it is possible to use reactJS library as well though reactJS includes pure html components.

Can react native recognize reactJS components including html?

like image 421
Smart Solutions Avatar asked Mar 06 '18 05:03

Smart Solutions


People also ask

Can I use JS library in React Native?

React Native is one of many JavaScript programming environments, including Node. js, web browsers, Electron, and more, and npm includes libraries that work for all of these environments.

Can I use the same code for React and React Native?

One of the remarkable facts about React-Native is that it's not only about building Native IOS/Android apps, but we can also build web applications using the same code and share more than 50% of codes between React-Native(Mobile) and React(Web) because we use React and JavaScript in both cases.

Can I use NPM packages in React Native?

So any front-end packages that are supposed to use HTML and be displayed in browser will not work. On the other hand, any modules that are pure javascript and run within node. js/io. js are perfectly OK to be run in react-native.


1 Answers

react library actually does not have anything related to Browser DOM HTML. Anything related to it separated into react-dom package. React Native does not and cannot use this library, because you don't have DOM underneath a react native application. However you can use most of the code/functionality you wrote for your mobile app in the browser, if you install necessary transpiling library. This is possible because react native defines some primitive components that can be ported to almost any platform. If you still want to use just HTML to render inside react native, you may use WebView for it.

like image 191
iamawebgeek Avatar answered Sep 23 '22 06:09

iamawebgeek