Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lazy loading to custom component images for performance improvements #4424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hichemfantar
Copy link
Contributor

Implement lazy loading for images across various components to enhance performance and reduce initial load times.

Copy link

netlify bot commented Jan 5, 2025

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit aea8438
🔍 Latest deploy log https://app.netlify.com/sites/react-native/deploys/6779d5e18107ed00088a209f
😎 Deploy Preview https://deploy-preview-4424--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding loading="lazy" is only recommended for images placed not in the initial user viewport, otherwise lazy loading could lead to worse feeling for the users, see:

For most altered components we cannot guarantee they will be below the fold.

Also, the Firefox has a know issue where the order of attributes matter, and loading need to be placed before src attribute, and the prop it itself have some requirements which need to be met which can also slow down the total time website takes to load:

For now, I'm leaning into leaving the code as-is, but if you can provide a performance analysis which will show that there is a meaningful benefit thanks to the changes, it would be a great way to win me over in this case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants