Skip to content

Instantly share code, notes, and snippets.

@cellog
Created March 21, 2017 18:29
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 cellog/b0b565019c21792d60066f418046f6a5 to your computer and use it in GitHub Desktop.
Save cellog/b0b565019c21792d60066f418046f6a5 to your computer and use it in GitHub Desktop.
using makePath for internal links
import { makePath } from 'react-redux-saga-router'
// if we have a route like this:
//const a = <Route name="foo" path="/my/:fancy/path(/:wow/*supercomplicated(/:thing))" />
export default () => {
<a href={makePath('foo', { fancy: 'pants' })}>links to /my/pants/path</a>
<a href={makePath('foo', {
fancy: 'pants',
wow: 'yes',
supercomplicated: '/this/works/just/fine'
})}>links to /my/pants/path/yes/this/works/just/fine</a>
<a href={makePath('foo', {
fancy: 'pants',
wow: 'yes',
supercomplicated: '/this/works/just/fine',
thing: 'wheeee'
})}>links to /my/paths/path/yes/this/works/just/fine/wheeee</a>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment