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-redirect
Advanced tools
Readme
Provides a declarative way to specify window.location
in a single-page app.
This component can be used on server side as well.
Built with React Side Effect.
====================
npm install --save react-redirect
Dependencies: React >= 0.11.0
props
and state
;Assuming you use something like react-router:
var App = React.createClass({
render: function () {
// Redirect to "www.driftt.com" if no child overrides this
return (
<ReactRedirect location='www.driftt.com'>
<this.props.activeRouteHandler />
</ReactRedirect>
);
}
});
var HomePageRedirect = React.createClass({
render: function () {
// redirect to "www.driftt.com" while this component is mounted
return (
<ReactRedirect location='www.driftt.com'>
</ReactRedirect>
);
}
});
var NewArticlePage = React.createClass({
mixins: [LinkStateMixin],
render: function () {
// Redirect using value from state when this component is mounted
return (
<ReactRedirect location={this.state.redirect || ''}>
<div>
Redirecting...
</div>
</ReactRedirect>
);
}
});
If you use it on server, call ReactRedirect.rewind()
after rendering components to string to retrieve the redirect location given to the innermost ReactRedirect
. You can then embed this title into HTML page template.
Because this component keeps track of mounted instances, you have to make sure to call rewind
on server, or you'll get a memory leak.
FAQs
A declarative, nested, stateful window.location for React
The npm package react-redirect receives a total of 148 weekly downloads. As such, react-redirect popularity was classified as not popular.
We found that react-redirect 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.