Which method is used before the dedication when new buildings or circuits are adopted?
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: "shouldComponentUpdate()". Câu dẫn là bản dịch máy của một câu trong tài liệu React, cần đọc lại như sau: dedication là rendering (lúc render), buildings or circuits là props or state, adopted là received; tức câu gốc hỏi phương thức nào được gọi trước khi render khi component nhận props hoặc state mới. Đó là shouldComponentUpdate(nextProps, nextState) trong component dạng class: nó trả về true để React tiếp tục render, hoặc false để bỏ qua lần cập nhật này, nhờ vậy dùng để tối ưu hiệu năng. "componentShouldMount()" không tồn tại trong vòng đời React; giai đoạn gắn chỉ có constructor, render và componentDidMount. "componentWillUpdate()" có thật nhưng chỉ chạy sau khi shouldComponentUpdate đã trả về true, ngay trước render, và nay đã đổi tên thành UNSAFE_componentWillUpdate vì không còn được khuyên dùng. "componentUpdate()" không phải phương thức vòng đời nào; tên gần nhất là componentDidUpdate, chạy sau khi render xong chứ không phải trước đó.
Cùng chương 2
A View component can be nested inside other views. Select the correct option.Có lời giảiCâu hỏiWhich component is the foundation for all React Native components and provides the base functionality for rendering elements to the screen?Có lời giảiCâu hỏiWhich keyword is used to extend a component from a base component?Có lời giảiCâu hỏiCả 54 câu của chủ đề54 câu