KyleAMathews / react-gravatar

React component for rendering a gravatar profile image
http://kyleamathews.github.io/react-gravatar/
MIT License
279 stars 33 forks source link

onError fallback component #146

Open zhuber opened 6 years ago

zhuber commented 6 years ago

This which allows users to specify a fallback component, which is great for folks who do not want to fallback to a different image source. For example, users can have a "default profile" component that gets passed in as the fallback prop.

Related feature request:

https://github.com/KyleAMathews/react-gravatar/issues/134

Usage

const fallbackComponent = <div>Fallback!</div>

return (
  <Gravatar email={email} size={40} default='404' className={s.avatar} fallback={fallbackComponent} />
)
jphenow commented 6 years ago

This would be great

getaaron commented 2 months ago

@KyleAMathews I resolved the conflicts in the PR (and in the other open one). I'm not sure what the demand is like for the feature but it seems reasonable to me, wdyt?