Created
June 21, 2016 15:54
-
-
Save rarous/0317739ccda9e4dbf56660ebd18a8438 to your computer and use it in GitHub Desktop.
Match that returns Promise instead of calling callback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: https://gist.github.com/rarous/2a45cb077cfe937b3318