-
-
Notifications
You must be signed in to change notification settings - Fork 677
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
Documentation how to use this libary with React & co. #187
Comments
You’re right, but I never tried it with any library yet. Did anyone try it already? |
I'm trying it at the moment with React. I will finish my implementation next week. If I still have time I can report how I implemented it. |
Please do. I would report the documentation in the main Readme file. It would be really useful to all the React community. |
Any updates? |
@sapkra did you make it? |
Sorry for my late answer but I had to pause my work because of priority reasons. We continued to work on it this week. I did it but I didn't had the time to post my results. I will set it on my todo list. |
Thank you very much. |
Do you have a document on the use of React? |
I'm asking for the support of the community here. I've never tried this on React. |
I wrote it some time ago. Maybe there is potential for improvements. Please feel free to comment. import PropTypes from 'prop-types';
import React from 'react';
import LazyLoad from 'vanilla-lazyload';
import lazyloadConfig from 'config/lazyload';
// Only initialize it one time for the entire application
if (!document.lazyLoadInstance) {
document.lazyLoadInstance = new LazyLoad(lazyloadConfig);
}
export class Image extends React.Component {
// Update lazyLoad after first rendering of every image
componentDidMount () {
document.lazyLoadInstance.update();
}
// Update lazyLoad after rerendering of every image
componentDidUpdate () {
document.lazyLoadInstance.update();
}
// Just render the image with data-src
render () {
const {
altText,
source,
} = this.props;
return (
<img
alt={altText}
className="rd__img"
data-src={source}
/>
);
}
}
export default Image; |
Very good job @sapkra! |
Thank you very much |
@xuya227939 I'm investingating on this on issue #230. |
Hey there, I'm reopening this because I need more information. How are you building your resources? It seems @xuya227939 you're using WebPack and UglifyJS. Is there any project / scaffolding from where I can copy your infrastructure to rapidly test LazyLoad in it? |
Hey,The 8.12.0 version is good,I'm using the local database, so I'm sorry I can't provide the project. |
You're right. |
Duplicate of #230 |
Hi everyone, @sapkra, @luisherranz, I created a new example of usage here on Sandbox. This implementation takes the same props that you would normally pass to the Have a nice week-end, |
Thanks @verlok! |
You’re welcome guys! :) |
In the readme file you tell me that I can use this library with React and other javascript frameworks but there is no documentation for it.
Would be nice if you can add example code. ;)
The text was updated successfully, but these errors were encountered: