Rohit
Rohit

Reputation: 7161

How are React Native modules different from Cordova plugins?

I was looking into comparison between Cordova based hybrid apps vs React Native and was confused how are React Native modules different from Cordova plugins?

(in case both are same, then why is FB reinventing the wheel)

Does React Native modules support all devices feature like Cordova does?

Thanks, Rohit

Upvotes: 3

Views: 1008

Answers (2)

DaveAlden
DaveAlden

Reputation: 30356

How are React Native modules different from Cordova plugins?

React Native Modules and Cordova Plugins both perform the same task: they allow the calling framework (React Native or Cordova) to invoke specific native functionality which is not available by default in the framework.

As such, the native functionality provided by a React Native module may be the same as provided by a Cordova plugin, but they will have a different interface to the framework which sits above. Therefore, it's possible to factorise out the common native code and have a native component which is made available as both a React Native module and a Cordova plugin.

For example react-native-background-geolocation vs cordova-background-geolocation.

Since only the interface to the native functionality differs, there have been some attempts to write a bridge to allow Cordova plugins to be used as modules in React Native, for example react-native-cordova.

Upvotes: 3

Vladyslav Zavalykhatko
Vladyslav Zavalykhatko

Reputation: 17374

The main difference is that Cordova uses HTML5 + CSS + JS for building hybrid apps. Your app will still run inside of webview. Although I've never worked with it, I can comment something

What does it mean?

  • I'm not sure about support of important features, like bluetooth, graphics, images (Core Graphics, Core Image), other core features
  • Performance also won't be the same as native app

React Native is different here, because all it does - translates your JS code into native code for platforms. The performance still can't be the same, but it's comparatively high.

Also, you can use native modules for your application in case you can't find one already created by others, so every feature accessible under platforms still be reached from React Native

Upvotes: 1

Related Questions