I was checking out the React Native website then I realized you can build web apps with React Native as well as Android/iOS apps. I was wondering what's the main difference between react-dom and React Native if both of these libraries can build web apps and manipulate the DOM.
What are the main features react-dom has which React Native doesn't?
You can't actually build web apps with React Native. You can use react-native-web for that, which implements React Native APIs on top of react-dom and browser APIs, but is not the same thing as React Native and doesn't use React Native.
Related
I am trying to use React and React Native in the same project but I only found the solutions which are using already made app with React Native over the web. Is it possible to write code in React but then use the same buisness logic in React Native?
I tried to use React Native in React but it was not compatible but React can be used in React Native. I want to use React Native in React.
I did like to find out how I can use next js as the web with react native as the developer used mono repo concept
I'm working on a react native app But I didn't get the reason of importing react with it.
It says in react-native website:
"React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces."
so React-native uses ReactJS, and you need to import it to use it.
React is the library that builds UI from JSX (Components, props, state, etc)
React native translates that UI into 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?
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.
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
I develop apps in React Native, I need to build my own libraries and to reuse them in multiple React Native projects.
With React Native I couldn’t link a library from outside the project, so I can't simply link my library to all my React Native apps.
What is the right way to do that?
I need to have a development environment to develop and test my library, but I need also to import my library in all the projects I need.