@economist/component-stickyfill

A React implementation of Stickyfill (https://github.com/wilddeer/stickyfill)

Usage no npm install needed!

<script type="module">
  import economistComponentStickyfill from 'https://cdn.skypack.dev/@economist/component-stickyfill';
</script>

README

By:EconomistBuild StatusBuild StatusCoverage Status

Stickyfill

A React implementation of Stickyfill (https://github.com/wilddeer/stickyfill)

Usage

This component expects an ES6 environment, and so if you are using this in an app, you should drop in a polyfill library - it has been tested with babel-polyfill but core-js or es6-shim may also work.

The default export is a React Component, so you can simply import the component and use it within some JSX, like so:

import Sticky from 'component-stickyfill';

return <Sticky><div className="some-sticky-child" /></Sticky>;

For more examples on usage, see src/example.es6.

Install

npm i -S component-stickyfill

Run tests

npm test