Smart Solutions
Smart Solutions

Reputation: 919

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?

Upvotes: 20

Views: 13943

Answers (2)

Manjurul Khan
Manjurul Khan

Reputation: 87

Usually libraries built specifically for other platforms will not work with React Native. Examples include react-select which is built for the web and specifically targets react-dom, and rimraf which is built for Node.js and interacts with your computer file system. Other libraries like lodash use only JavaScript language features and work in any environment. You will gain a sense for this over time, but until then the easiest way to find out is to try it yourself. You can remove packages using npm uninstall if it turns out that it does not work in React Native. -- source: React native official docs

Upvotes: 1

iamawebgeek
iamawebgeek

Reputation: 2865

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.

Upvotes: 11

Related Questions