Skip to content

Add onError to img element #134

@cjke

Description

@cjke

Gravatar accepts a type of "404" - which, if the email is invalid, will return a 404 status code (instead of say retro or wavatar, etc).

Currently though, there is no way to capture that and action via react-gravatar. It would be nice to be able to pass in a onError prop, and let it be mounted to the img element. This way, a parent component, could catch it, and render a more app relevant default image.

Alternatively, a defaultComponent prop could be passed, that when a 404 is returned, the react-gravatar would render it instead.

Happy to PR if this aligns with the projects goals

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions