Why might you need to use a Native Module in a React Native application?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng gồm hai ý: "To access native (operating system) APIs that JavaScript does not support by default." và "To use available native libraries already written in Java (for Android) or Objective-C/Swift (for iOS).". Native Module (mô-đun gốc) là lớp mã Java/Kotlin hoặc Objective-C/Swift được đăng ký với React Native để JavaScript gọi tới; nó cần thiết vì JavaScript chỉ thấy những gì framework đã phơi ra, còn các API hệ điều hành khác như Bluetooth, cảm biến đặc thù hay SDK thanh toán phải được bọc lại mới dùng được, và đó cũng là cách tái sử dụng thư viện native có sẵn thay vì viết lại. "To completely replace JavaScript with native code." sai vì Native Module chỉ bổ sung từng chức năng, phần lớn logic và giao diện vẫn viết bằng JavaScript; thay hẳn thì không còn là React Native. "To write more maintainable user interface code." sai vì mã native thường khó bảo trì hơn, phải giữ hai bản cho hai nền tảng; giao diện dễ bảo trì là nhờ component React, không phải nhờ Native Module.
Cùng chương 1
Ordering steps in the process of how React Native works in Bridge architecture:
1.The main cable starts working and starts loading JavaScript loads
2.Produces a new DOM (structure) and sends changes to Shadow cable
3.If the JavaScript code is successfully uploaded, the main thread sends it to another JavaScript thread
4.Main thread is able to render something on the screen
5.The shadow string calculates the structure and sends the parameters/properties of the structure to the main sequenceCó lời giảiCâu hỏiReact Native uses the following tech stack to build cross-platform native apps:Có lời giảiCâu hỏiHow does React Native differ from React.js in terms of rendering components?Có lời giảiCâu hỏiCả 54 câu của chủ đề54 câu