-
Notifications
You must be signed in to change notification settings - Fork 4
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
Minor improvements suggestions #4
Comments
Also by importing import { Image } from "load-image-react"; I see that it includes more than 20KB. It's more than React lib itself. It's really needed to include all https://github.com/blueimp/JavaScript-Load-Image inside that package ? |
@bartlomiejzuber Thanks for this! I agree with points 1 and 3. For point 2, it needs to call the Also unfortunately I don't think we'll be able to reduce the import size because there's only a single export from |
Don't get it. You just do same thing on So it would look like this: public shouldComponentUpdate(prevProps: ImageProps) {
return this.props.src === prevProps.src
}
public getSnapshotBeforeUpdate() {
this.renderImage();
} or public shouldComponentUpdate(prevProps: ImageProps) {
return this.props.src === prevProps.src
}
public componentDidUpdate() {
this.renderImage();
} Also do we need await for
How about that? 🎉 vs Thanks James that you are open for discussion. |
@bartlomiejzuber I agree that your example there with I don't think we can do those manual file imports because then we will lose the scripts for EXIF parsing etc |
Hi @Jameskmonger , I've look at code and got few suggestions.
Please take a look at them. Don't know if contributes are welcome here so I would rather ask than making PR with those changes.
If you don't like them just close the issue.
React.createRef()
Right now each render creates new arrow function with ref, it's not a ideal for performance.The thing you used here is callback ref it's designed especially to pass it to inner components but here is vanilla DOM component not custom JSX component.
lastChild
is faster. ;)The text was updated successfully, but these errors were encountered: