1.

What is a bridge and why is it used in React Native ? Explain for both android and IOS ?

Answer»

Bridge in ReactNative is a layer or simply a connection that is responsible for gluing 
together Native and JavaScript environments.

Consider Below diagram:

  • The layer which is closest to the device on which the application runs is the Native Layer.
     
  • The bridge is BASICALLY a transport layer which acts as a connection between Javascript and Native modules, it does the work of transporting asynchronous serialized batched response messages from JavaScript to Native modules.

    Now for an example, there is some STATE change that happens, because of which REACT Native will batch UPDATE UI and send it to the Bridge. The bridge will pass this Serialized batched response to the Native layer, which will process all commands that it can distinguish from a serialized batched response and will update the User Interface accordingly.

    IOS Platform:

 


     Android Platform:                      

         


 



Discussion

No Comment Found