Skip to content

sugarshin/react-social

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

React components for social share on ES6 class

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%