
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
react-router-historian
Advanced tools
Keeps an accessible record of past locations in react-router (v3.x) apps
#React Router Historian
Keeps a record of past locations in react-router (v4.x) apps. This is useful when you for example need a contextual back button:
##Requirements
This plugin is written for React Router 3.X
##Installation
Yarn: $ yarn add react-router-historian
NPM: $ npm i reaction-router-historian -S
##Usage and Example
You first need to wrap your app with the HistorianProvider which listens to React Router changes:
import { render } from 'react-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import { Historian } from 'react-router-historian';
const App = () => (
<Router>
<Historian>
// ...
</Historian>
</Router>
);
render(<App />, document.getElementById('app'));
Next, you wrap the components that read and edit (see below) history with the withHistorian HOC:
import { React } from 'react';
import { withHistorian } from 'react-router-historian';
class MyComponent extends React.Component {
componentWillReceiveProps(props) {
props.updateCurrentLocation({ title: 'MyComponentTitle' });
}
}
export withHistorian(MyComponent);
class MyOtherComponent extends React.Component {
backFunc() {
// ...
}
render() {
const lastPage = this.props.getLastLocation();
return (
<div>
<button onClick={backFunc}>Back to {lastPage.title}</button>
</div>
);
}
}
export withHistorian(MyOtherComponent);
##Component functions
These functions are made available via props to the components wrapped with withHistorian
:
###getCurrentLocation():Object
###getLastLocation():Object
###updateCurrentLocation(location)
##Thanks
React Router Historian is heavily inspired by react-router-last-location by Dawid Karabin
NPM package exists thanks to react-build-lib by adrianmcli
FAQs
Keeps an accessible record of past locations in react-router (v3.x) apps
We found that react-router-historian 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.