Closed cameronhunter closed 8 years ago
@cameronhunter does it work for you? because in my case it fails on .filter(({ fetcher }) => fetcher)
I don't know if there is a better way to do it, but here is what I did:
...
const promises = (Array.isArray(components) ? components : [components])
.filter(component => component)
// Get component fetcher functions
.map(component => ({ component, fetcher: component[name] }))
...
e.g.
> const array = [undefined, 1, 'foo', undefined, undefined, null, 2, 3, false, 0]
'use strict'
> array.filter(x => x)
[ 1, 'foo', 2, 3 ]
Yep, I prefer your method – I've created a new pull request.
Handle routes with undefined components such as: