Simple React components for social (Facebook, Twitter and Pinterest and more) buttons and counts.
npm install react-social --save
import { FacebookButton, FacebookCount } from "react-social";
class App {
render {
let url = "https://github.com";
return (
<FacebookButton url={url}>
<FacebookCount url={url} />
{" Share " + url}
</FacebookButton>
);
}
}
Change the element the component renders into, default is span
.
The url you want to get the count of, default is window.location
.
Return the social count.
Change the element the component renders into, default is button
.
The url you want to share, default is window.location
.
A message that's prepended before the url, works only with FacebookButton and TwitterButton.
Url of an image, is required for PinterestButton and only works with PinterestButton.
There are no styles included, the components pass all their props down
to their element like className
and style
so you can easily style
them yourself.
When rendered server side all counts will be 0 since they depend on jsonp.
- Ola Holmström (@olahol)
- Alexandr Sugak (@AlexSugak)
- Jon Principe (@jprincipe)
MIT Licensed