Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools oft miss.
redux-lazy-scroll
Advanced tools
React/Redux lazy scrolling functionality with full Redux implementation example.
You can see the demo here: https://ancient-sands-71156.herokuapp.com/
npm install redux-lazy-scroll --save
class PostsLazyScroll extends Component {
constructor(props) {
super(props);
this.loadPosts = this.loadPosts.bind(this);
}
loadPosts() {
const {skip, limit} = this.props.postEntity;
this.props.postsActions.fetchPosts(skip, limit);
}
render() {
const {posts, isFetching, errorMessage, hasMore} = this.props.postEntity;
return (
<div className="container posts-lazy-scroll">
<ReduxLazyScroll
isFetching={isFetching}
errorMessage={errorMessage}
loadMore={this.loadPosts}
hasMore={hasMore}
>
{posts.map(post => (
<Post
key={post._id}
post={post}
/>
))
}
</ReduxLazyScroll>
<div className="row posts-lazy-scroll__messages">
{isFetching && <div className="alert alert-info"> Loading more posts... </div>}
{!hasMore && !errorMessage &&
<div className="alert alert-success">All the posts has been loaded successfully.</div>
}
{errorMessage && <div className="alert alert-danger">{errorMessage}</div>}
</div>
</div>
);
}
}
You can find full Redux example here
Props | Type | Required | Default | Description |
---|---|---|---|---|
hasMore | bool | no | true | Whether there are more items that will be coming with the next request |
isFetching | bool | no | false | Should be set true while a request to api is being processed |
errorMessage | string or bool | no | false | Supply any error message that came from the api with this prop (this will help to avoid infinite loops in case of error) |
loadMore | func | no | () => {} | The function that will be called after every scroll down when threshold is passed (will be only called if hasMore is true) |
threshold | number | no | 100 | The number of pixels above the bottom side of the page that scrollbar needs to reach to trigger loadMore |
isParentScrollable | bool | no | false | Whether the scroll listener should be attached to the parent element or window |
parentHeight | number or string | if isParentScrollable is true | false | The height of the container parent element. Must be set if isParentScrollable is true |
MIT License. Copyright (c) 2017 Shota
FAQs
React/Redux infinite/lazy scrolling/loading functionality.
The npm package redux-lazy-scroll receives a total of 299 weekly downloads. As such, redux-lazy-scroll popularity was classified as not popular.
We found that redux-lazy-scroll 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools oft miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.