What is Fabric in React Native?

Technology CommunityCategory: React NativeWhat is Fabric in React Native?
VietMX Staff asked 3 years ago
  • Fabric is the new React Native architecture proposed by the community to make the mobile application user experience close or even better than the native apps.
  • Fabric is based on dividing the tasks into sync and async tasks which would be handled by the immutable shadow thread followed by the memory refinements.

There are basically three main principles of Fabric :

  • Prioritizing the Tasks : – JavaScript treats all async events as the same and all of the events/processes are treated equally in terms of resource allocation – With Fabric, the user interactions such as scrolling, touch, hold, gestures etc will be prioritized and will be executed synchronously in the main thread or native thread. – Other tasks such as API requests will be executed asynchronously.
  • Immutable Shadow Tree – This is a very important concept which would ensure that there would not be any deadlock condition independent of a synchronous or asynchronous request. – With this, it won’t matter where the changes are coming from as long as our tree is consistent with all other thread that it is being shared with.
  • Reducing Memory Consumption – A new concept is introduced to keep a single copy of DOM nodes, instead of 2, in the memory while the other threads such as JavaScript would only have a reference of it to perform any operations.