React components for social share on ES6 class
Fork on olahol/react-social
npm install @sugarshin/react-social
import React from 'react';
import {
FacebookButton,
FacebookCount
} from 'react-social';
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<FacebookButton url={this.props.url}>
<FacebookCount url={this.props.url} />
{`Share ${this.props.url}`}
</FacebookButton>
);
}
}
React.render(
<App url={'https://github.com/sugarshin/react-social'} />,
document.body
);
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
.
Url of an image, required for PinterestButton.
The components pass their props down to their element including className
and
style
.
© sugarshin