Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-router-link-nostack
Advanced tools
Changelog
1.0.12 29-July-2020
Readme
🎈 Prevent stacking in browser history upon re-navigating current route with custom React Router Link Component.
🌟 almost 0 learning curve.
🔔 0 dependency.
⛲️ Out of box typescript support.
🦺 Tested.
Note: You need React Router v5.1
or above to use this!
npm i react-router-link-nostack
View it at GhPage!
Try it at Code Sandbox!
simply use it just like you use React Router Link
import React from 'react'
import { render } from 'react-dom'
import Link from 'react-router-link-nostack'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import { Helmet } from 'react-helmet'
const Demo = () => {
return (
<BrowserRouter basename={'/'}>
<div>
<h1>react-router-link-nostack Demo</h1>
<Link to='/'>to index</Link>
<br />
<Link to='/profile'>to profile</Link>
</div>
<br />
<Switch>
<Route
exact
path='/'
render={() => {
return (
<>
<Helmet>
<title>Index</title>
</Helmet>
<p>Now at Index Page(route: '/')</p>
</>
)
}}
/>
<Route
exact
path='/profile'
render={() => {
return (
<>
<Helmet>
<title>Profile</title>
</Helmet>
<p>Now at Profile Page(route: '/profile')</p>
</>
)
}}
/>
</Switch>
<p>
try to click the same route multiple time and see it wont add to history
stack!
</p>
</BrowserRouter>
)
}
render(<Demo />, document.getElementById('root'))
This Link
works like and has the same properties as React Router's Link, plus:
onSamePage(event)
: callback that trigger when user revisit the same page, can be undefined or null, accept event object.<Link
to='/profile'
onSamePage={() => {
console.log('same page and wont stack history!')
}}
>
to profile
</Link>
FAQs
🎈 <Link/> that prevent stacking in browser history upon re-navigating current route
The npm package react-router-link-nostack receives a total of 0 weekly downloads. As such, react-router-link-nostack popularity was classified as not popular.
We found that react-router-link-nostack 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.