
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@foo-software/react-scroll-context
Advanced tools
A React scroll context provider and consumer for detecting scroll position (scrollX, scrollY) and providing that data to child components.
@foo-software/react-scroll-contextReact Scroll Context exports a React context provider and consumer. It provides
windowscroll data to a consumer.
npm
npm install @foo-software/react-scroll-context
yarn
yarn add @foo-software/react-scroll-context
react@16.8| Name | Description | PropType | Required | Default |
|---|---|---|---|---|
Context | A Context object created by React.createContext() | object | true | -- |
children | Anything that can be rendered, but typically a tree of elements. Scroll data can be consumed from anywhere in this tree. | node | true | -- |
scrollContainer | A scroll container. This will be window by default, but you could use an element instead with this option. | oneOf[PropTypes.object, PropTypes.node] | false | window |
throttleTime | Time in milleseconds to throttle calculations of scroll. | number | false | 200 |
| Name | Description | Type |
|---|---|---|
scrollX | The current value of window.scrollX. | number |
scrollY | The current value of window.scrollY. | number |
isScrollingDown | Identifies whether or not scroll direction is down. | boolean |
Standard
import React from 'react';
import { ScrollProvider } from '@foo-software/react-scroll-context';
// replace `scroll-context` any name you like.
const Context = React.createContext('scroll-context');
const ScrollDisplay = () => (
<ScrollProvider
Context={Context}
>
<div>
<h1>Scroll it!</h1>
<Context.Consumer>
{({ scrollX, scrollY, isScrollingDown }) => (
<pre>
scrollX: {scrollX}
scrollY: {scrollY}
isScrollingDown: {isScrollingDown ? 'yes' : 'no'}
</pre>
)}
</Context.Consumer>
</div>
</ScrollProvider>
);
Class
import React, { Component } from 'react';
import { ScrollProvider } from '@foo-software/react-scroll-context';
// replace `scroll-context` any name you like.
const Context = React.createContext('scroll-context');
class ScrollDisplay extends Component {
static contextType = Context;
render() {
const { scrollX, scrollY, isScrollingDown } = this.context;
return (
<pre>
scrollX: {scrollX}
scrollY: {scrollY}
isScrollingDown: {isScrollingDown ? 'yes' : 'no'}
</pre>
);
}
}
const App = () => (
<ScrollProvider
Context={Context}
>
<div>
<h1>Scroll it!</h1>
<ScrollDisplay />
</div>
</ScrollProvider>
);
useContexthook
import React, { useContext } from 'react';
import { ScrollProvider } from '@foo-software/react-scroll-context';
// replace `scroll-context` any name you like.
const Context = React.createContext('scroll-context');
const ScrollDisplay = () => {
const { scrollX, scrollY, isScrollingDown } = useContext(Context);
return (
<pre>
scrollX: {scrollX}
scrollY: {scrollY}
isScrollingDown: {isScrollingDown ? 'yes' : 'no'}
</pre>
);
};
const App = () => (
<ScrollProvider
Context={Context}
>
<div>
<h1>Scroll it!</h1>
<ScrollDisplay />
</div>
</ScrollProvider>
);
This package was brought to you by Foo - a website performance monitoring tool. Create a free account with standard performance testing. Automatic website performance testing, uptime checks, charts showing performance metrics by day, month, and year. Foo also provides real time notifications when performance and uptime notifications when changes are detected. Users can integrate email, Slack and PagerDuty notifications.
FAQs
A React scroll context provider and consumer for detecting scroll position (scrollX, scrollY) and providing that data to child components.
We found that @foo-software/react-scroll-context demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.