@sugarshin/react-social

0.0.2 • Public • Published

react-social

GitHub version License

React components for social share on ES6 class

Fork on olahol/react-social

Getting started

npm install @sugarshin/react-social

Usage

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);

Count (FacebookCount, TwitterCount, PinterestCount) API

Props

element

Change the element the component renders into default is span.

url

The url you want to get the count of, default is window.location.

Methods

getCount()

Return the social count.

Button (FacebookButton, TwitterButton, PinterestButton) API

Props

element

Change the element the component renders into default is button.

url

The url you want to share, default is window.location.

media (required for Pinterest)

Url of an image, required for PinterestButton.

Styles

The components pass their props down to their element including className and style.

License

MIT

© sugarshin

Package Sidebar

Install

npm i @sugarshin/react-social

Weekly Downloads

7

Version

0.0.2

License

MIT

Last publish

Collaborators

  • sugarshin