JavaScript <-> Native communication
Because the code of your MiniApps written in JavaScript will be executing inside a JavaScript virtual machine in the mobile application, they don't have direct access to your mobile application data, nor can they invoke any methods in the mobile application. The same is true the other way arround.
React Native offers communication between the JavaScript side and the Native side through its internal bridge, mostly surfaced to the developpers trhough Native Modules.
Electrode React Native, in addition to allow you to reuse existing React Native Native Modules, comes with its own bridge (which is actually nothing more than a Native Module), built on top of exiting communication constructs offered by React Native out of the box.
Electrode React Native bridge offers bi-directional type safe communication, exposed as events and requests/responses constructs, and can be used directly in your mobile application or MiniApp to help communication between the two sides; however, using Electrode React Native, you will mostly not interact directly with the bridge, but rather with what we call APIs.
Electrode React Native APIs are in some sense equivalent to React Native Native Modules.
As for Native Modules, you can create your own APIs and distribute them, or re-use existing ones.
While you can create new Native Modules and use them with Electrode React Native, this is not the recommended approach. Indeed, you'll want to create APIs instead as they are well integrated with the platform and offer a few advantages compared to native modules when it comes to working with the platform :
APIsare fully generated. Just define the interactions it will offers, as aSwaggerschema, in terms ofeventsandrequestsand the necessaryAPIclient code, and implementation support code, will be generated for JavaScript/iOS and Android.APIsalso support the generation of model classes. Just define your models in yourSwaggerschema and the necessary classes will be generated. Relying onElectrode React Nativebridge support, this means that on the mobile application side, developers will be able to work with real models, and will be able to properly leverage their compilation time checks when dealing withAPIs.APIsdecouple the client code of theAPIfrom its implementation. You are free to implement theAPIon thenativeside or theJavaScriptside. Because of this decoupling, it is also possible to write multiple implementations for a singleAPI.APIsare notNative Modules. They are clients of theElectrode React Nativebridge which is theNative Module. In that sense, there is no "linking" required forAPIs.APIsare generated and therefore will all follow the exact same file system structure. This means that they don't need any specific configuration to be written forElectrode React Nativeto properly add them to a container.APIsare expected to follow a certain versioning convention, offering more flexibility it terms of compatibility checks between different versions.