@wpdas/react-tweet
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Tweet - React Component

Build Status Build Size Version

A simple Tweet component for ReactJS apps.

Install

Install it using npm or yarn:

# npm
npm install @wpdas/react-tweet

# yarn
yarn add @wpdas/react-tweet

How to use

import { Tweet } from '@wpdas/react-tweet'

const App = () => {
  return (
    <>
      <Tweet
        tweetURL="https://twitter.com/wpdas/status/1648406388127801347"
        onRender={() => console.log('rendered')}
        onError={(err: string) => console.log(err)}
        options={{ theme: 'dark' }}
      />
    </>
  )
}

export default App

tweetURL: (must) this is the tweet URL

onRender: (optional) method called when the tweet renders

onError: (optional) method called when there's an issue with the provided URL

options: (optional) you can set some options like:

type Options = {
  conversation?: 'none' | 'all'
  cards?: 'hidden' | 'visible'
  linkColor?: string
  theme?: 'light' | 'dark'
}

How it looks after rendering:

Tweet example

Good to know

The component will be re-rendered when the tweetURL or options property is changed.

Package Sidebar

Install

npm i @wpdas/react-tweet

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

19.4 kB

Total Files

25

Last publish

Collaborators

  • wpdas