Which statement is true about how Native Modules work?
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: "Native Modules provide the ability to execute native code (Java/Objective-C/Swift) from within JavaScript.". Mỗi Native Module phơi ra một tập phương thức (đánh dấu @ReactMethod trên Android hoặc RCT_EXPORT_METHOD trên iOS); JavaScript lấy module qua NativeModules hoặc TurboModule rồi gọi, lời gọi được chuyển qua bridge (hoặc JSI ở kiến trúc mới) sang mã native, kết quả trả về bằng callback hoặc Promise. "Native Modules directly convert JavaScript code into C++." sai vì không có bước dịch JavaScript sang C++; mã JavaScript vẫn chạy trên engine như Hermes, Native Module chỉ là đích của lời gọi. "Native Modules only support Android and not iOS." sai vì cơ chế này có trên cả hai nền tảng, mỗi bên viết bằng ngôn ngữ riêng. "Native Modules act as a bridge between the interface layer and the database." sai vì nó là cầu nối giữa JavaScript và mã native nói chung, không chuyên cho cơ sở dữ liệu; dùng nó để truy cập SQLite chỉ là một trường hợp cụ thể.
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