Skip to content

Instantly share code, notes, and snippets.

@rarous
Created June 21, 2016 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rarous/0317739ccda9e4dbf56660ebd18a8438 to your computer and use it in GitHub Desktop.
Save rarous/0317739ccda9e4dbf56660ebd18a8438 to your computer and use it in GitHub Desktop.
Match that returns Promise instead of calling callback.
import match from 'react-router/lib/match';
const matchResult = (resolve, reject) => (err, redirectLocation, renderProps) => err ? reject(err) : resolve({redirectLocation, renderProps});
const matchExecutor = ctx => (resolve, reject) => match(ctx, matchResult(resolve, reject));
export default ctx => new Promise(matchExecutor(ctx));
@rarous
Copy link
Author

rarous commented Jun 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment