[5:53]
I’ll put it in a new branch though, and do a pull request
[5:53]
might be some other considerations, like size etc.
[5:54]
but you also need to specify the language for the given snippet. Here’s the markdown for that image:
routeNum: ownProps.routes.filter(r => r.path).length
})
So we can include two types of `name` prop in our Route components in `routes.js`:
1. Functions, that pull it out of state.
2. Strings, that are directly formatted.
<pre class="language-jsx">
<code class="language-jsx">
<Route name={state => state.locations.name} path={'locations/:id'} component={Locations}/>
<Route name={'locations'} path={'locations/:id'} component={Locations}/>
</code>
</pre>
Then, finally, we can do a bit of further mapping and reducing in the Breadcrumb container component to concatenate the paths correctly and evaluate the params.
// Evaluate and replace multiple params in path
// eg. door/:id/foo/:doorId -> door/2/foo/5
const replaceParams = params => route => {
const matches = route.path.match(/:([^\/]+)/g) || [];
Jonathan King [5:52 PM]
there it’s running alongside code-prettify
[5:53]
with a little bit more logic in the includer:
[5:53]
I’ll put it in a new branch though, and do a pull request
[5:53]
might be some other considerations, like size etc.
[5:54]
but you also need to specify the language for the given snippet. Here’s the markdown for that image: