
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Declarative routing for React.
React Router keeps your UI in sync with the URL. Make the URL your first thought, not an after-thought.
Using npm:
$ npm install --save teardrop@5.0.0
Then with a module bundler like webpack, use as you would anything else:
// using an ES6 transpiler, like babel
import { BrowserRouter, Match, Link, Miss } from 'teardrop'
// not using an ES6 transpiler
var BrowserRouter = require('teardrop').BrowserRouter
var Match = require('teardrop').Match
var Link = require('teardrop').Link
var Miss = require('teardrop').Miss
You can find the library on window.Teardrop.
We're going to try and get the docs sorted out here.
We weren't happy with the direction of teardrop, so we've decided to branch out and provide our own version.
No, we're not about that. We'll try and ensure everything is backwards compatible for as long as possible.
We like it.
Transition's can be done within render of a Match.
<Match render={() => {
doStuffHere();
return <ComponentHere />
}}/>
One use case was loading data and waiting to render the next screen until the data landed. With a component, you can save the previous children, render them while loading, and then render your new children when you're done. We'll have an example of this eventually.
Check out the "Route Config" example.
website/examples/RouterConfig.js
Right now, because we're lacking pretty documentation, you'll have to use this example and the modules/tests folder to figure out what's going on. Doccos are in progress. :)
import { ServerRouter, MatchGroup, Match, Miss, Redirect, createServerRenderContext } from 'teardrop';
const location = '/test' // Set this using your server
const routerContext = createServerRenderContext();
render() {
return (
<ServerRouter location={URL from server} context={routerContext}>
{/* This component will return every time the pattern is matched - anywhere in the app */}
<Match
exact={true|false}
pattern="*"
render={({ params, location, pathname, isExact}) => {
// params is an object containing params from your pattern
// location is the current location object
// pathname is the current pathname
// isExact is true when the pattern is an "exact" match (ie. "/" === "/")
// pattern is also returned in case you want it
return <div />
}}
/>
<MatchGroup>
// Put as many matches in here as you want, it'll only match ONE of them
<Match pattern="hi" render={Hi} />
<Match pattern="hello" render={Hello} />
<Match pattern="hey" render={Hey} />
</MatchGroup>
{ /* Simple redirect component */ }
<Match pattern="/old-link" render={() => {
<Redirect to="/new-link" />
}} />
{ /* Nothing matched? We produce a Miss */ }
<Miss render={ErrorPage} />
</ServerRouter>
);
}
import { BrowserRouter, MatchGroup, Match, Miss, Redirect, createServerRenderContext } from 'teardrop';
render() {
return (
<BrowserRouter>
{/* This component will return every time the pattern is matched - anywhere in the app */}
<Match
exact={true|false}
pattern="*"
render={({ params, location, pathname, isExact}) => {
// params is an object containing params from your pattern
// location is the current location object
// pathname is the current pathname
// isExact is true when the pattern is an "exact" match (ie. "/" === "/")
// pattern is also returned in case you want it
return <div />
}}
/>
<MatchGroup>
// Put as many matches in here as you want, it'll only match ONE of them
<Match pattern="hi" render={Hi} />
<Match pattern="hello" render={Hello} />
<Match pattern="hey" render={Hey} />
</MatchGroup>
{ /* Simple redirect component */ }
<Match pattern="/old-link" render={() => {
<Redirect to="/new-link" />
}} />
{ /* Nothing matched? We produce a Miss */ }
<Miss render={ErrorPage} />
</BrowserRouter>
);
}
5.0.1
router and location props to the Router's only child.5.0.2
MatchGroup for ease of use.5.0.3
FAQs
Declarative routing for React
We found that teardrop 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.