Package Exports
- react-scrollama
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-scrollama) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Scrollama
React Scrollama is a simple interface for scrollytelling that uses IntersectionObserver in favor of scroll events. It is adapted from Russel Goldenbeg's Scrollama and was first introduced at React NYC: HyHNuVaZJ (watch the full talk here).
Installation
React Scrollama can be installed as an npm package:
$ npm install react-scrollama
Basic Usage
import React, { PureComponent } from 'react';
import { Scrollama, Step } from 'react-scrollama';
class Graphic extends PureComponent {
state = {
data: 0,
};
onStepEnter = ({ element, data, direction }) => this.setState({ data });
render() {
const { data } = this.state;
return (
<div>
<p>data: {data}</p>
<Scrollama onStepEnter={this.onStepEnter}>
<Step data={1}>
<p>step 1</p>
</Step>
<Step data={2}>
<p>step 2</p>
</Step>
</Scrollama>
</div>
);
}
}