React component to put a CrowdRiff embed code in a React app
npm install react-crowdriff-galleryThis lightweight component allows CrowdRiff customers to embed their galleries on websites built in React
Install via npm or your package manager of choice!
```
npm install react-crowdriff-gallery
Import and use
`
import { CrowdRiffGallery } from 'react-crowdriff-gallery'
class App extends Component {
render() {
|Prop Name | isRequired | type | Description |
|---|---|---|---|
|
hash | true | string | 8 or 16 character hash found in the gallery's embed code |$3
The gallery hash is located within the id field of the embed code, prepended by either cr-init__ or cr__init- depending on the version.
`
OR
`
$3
The component handles the embedding of the script onto the page, as well as hooking into the crowdriff__gallery window object that registers and renders gallery objects. As a result, the setup and teardown is in the componentDidMount and componentWillUnmount lifecycle methods. If you want to dynamically change gallery hashes, set a key prop equal to the hash on the component to trigger a new instance of the component.`
Dynamic gallery example
class DynamicGallery extends Component {
render() {
}
}
``