attach-embeds-react
Version:
React components for Attach Embeds
74 lines (53 loc) • 1.24 kB
Markdown
for Attach Embeds
npm
```
$ npm install --save attach-embeds attach-embeds-react
```
yarn
```
$ yarn add attach-embeds attach-embeds-react
```
```js
import React from 'react'
import { attach, Reactions, Preview } from 'attach-embeds-react'
class App extends React.Component {
componentDidMount() {
if (!attach.isInitialized()) {
attach.setProperties({
'attach:item': `https://www.attach.live`,
'attach:reactions:hide-sections': ['comments', 'videos'],
})
attach.initialize()
}
}
render() {
return (
<>
<div>
<Reactions item="https://developers.attach.live" />
</div>
<div>
<Reactions properties={{ hide-sections: 'videos' }} />
</div>
<div>
<Preview />
</div>
</>
)
}
}
```
Embeds API, convenient re-export from `attach-embeds`
All components accept these common props:
- `className`, `style`
- `properties` - object, set [properties](https://github.com/attach-live/attach-properties) local to the embed
- `item` - same as setting `properties={{ 'attach:item': '...' }}`
Renders the reactions embed.
Renders the preview embed.
React components