Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-scroll-to-component
Advanced tools
Smooth srolls to react component via reference
npm install react-scroll-to-component --save
yarn add react-scroll-to-component
scrollToComponent(ref, <options>)
Add an offset to the final position. if > 0 then page is moved to the bottom otherwise the page is moved to the top.
Alignment of the element. Can be one of
'top'
,'middle'
or'bottom'
. Defaulting to'middle'
.
Easing function defaulting to "out-circ" (view ease for more)
Animation duration defaulting to
1000
import scrollToComponent from 'react-scroll-to-component';
// without options
scrollToComponent(this.refs.name);
//with options
scrollToComponent(this.refs.name, {
offset: 1000,
align: 'top',
duration: 1500
});
import React, { Component } from 'react';
import './App.css';
import scrollToComponent from 'react-scroll-to-component';
class App extends React.Component {
componentDidMount() {
scrollToComponent(this.Blue, { offset: 0, align: 'middle', duration: 500, ease:'inCirc'});
}
render() {
return (
<div className='main'>
<div className='button_group'>
<button onClick={() => scrollToComponent(this.Violet, { offset: 0, align: 'top', duration: 1500})}>Go To Violet</button>
<button onClick={() => scrollToComponent(this.Indigo, { offset: 0, align: 'bottom', duration: 500, ease:'inExpo'})}>Go To Indigo</button>
<button onClick={() => scrollToComponent(this.Blue, { offset: -200, align: 'middle', duration: 1500, ease:'inCirc'})}>Go To Blue</button>
<button onClick={() => scrollToComponent(this.Green, { offset: 0, align: 'middle', duration: 500, ease:'inExpo'})}>Go To Green</button>
<button onClick={() => scrollToComponent(this.Yellow, { offset: 0, align: 'top', duration: 1500, ease:'inCirc'})}>Go To Yellow</button>
<button onClick={() => scrollToComponent(this.Orange, { offset: 0, align: 'top', duration: 500, ease:'inCirc'})}>Go To Orange</button>
<button onClick={() => scrollToComponent(this.Red, { offset: 0, align: 'top', duration: 500})}>Go To Red</button>
</div>
<section className='violet' ref={(section) => { this.Violet = section; }}>Violet</section>
<section className='indigo' ref={(section) => { this.Indigo = section; }}>Indigo</section>
<section className='blue' ref={(section) => { this.Blue = section; }}>Blue</section>
<section className='green' ref={(section) => { this.Green = section; }}>Green</section>
<section className='yellow' ref={(section) => { this.Yellow = section; }}>Yellow</section>
<section className='orange' ref={(section) => { this.Orange = section; }}>Orange</section>
<section className='red' ref={(section) => { this.Red = section; }}>Red</section>
<b>Inspired By <a href="https://hopechen1028.github.io/hopechen.me/" target="_blank">Hope</a> with Love and Peace</b>
</div>
)
}
}
export default App;
MIT
FAQs
smooth scrolling to react component via reference
The npm package react-scroll-to-component receives a total of 5,906 weekly downloads. As such, react-scroll-to-component popularity was classified as popular.
We found that react-scroll-to-component 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.