How does React Native achieve cross-platform development with a single codebase?
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: "By leveraging JavaScript and React". React Native cho phép viết một codebase bằng JavaScript (hoặc TypeScript) theo mô hình component của React; lúc chạy, các component như View, Text, Image được ánh xạ thành thành phần giao diện native thật của từng nền tảng, còn logic chạy trên engine JavaScript như Hermes. Nhờ vậy cùng một mã nguồn sinh ra ứng dụng cho cả iOS lẫn Android. "Via HTML and CSS only" sai vì React Native không dùng HTML; giao diện dựng bằng component riêng, style viết bằng đối tượng JavaScript giống CSS chứ không phải CSS thật. "By using native Swift and Kotlin separately" sai vì viết riêng Swift và Kotlin là hai codebase, đúng điều React Native muốn tránh. "Through web views in mobile browsers" sai vì đó là cách của ứng dụng lai như Cordova hay Ionic; React Native không vẽ giao diện trong web view.
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