useDeferredValue (React 18) trả về phiên bản deferred của giá trị, React có thể giữ giá trị cũ khi render expensive component trong khi urgent update hoàn thành.
- Khác useTransition: không wrap update code, wrap giá trị result.
- Tốt khi không control code cập nhật state (nhận từ props).
- Kết hợp với React.memo để maximize benefit.
useDeferredValue (React 18) returns a deferred version of a value — React can keep showing the old value while an expensive component re-renders and urgent updates complete first.
- Unlike useTransition, you wrap the resulting value rather than the update code.
- It is ideal when you do not control the code that updates state (e.g., the value comes from props).
- Combine with React.memo to maximize the benefit.