I just migrated an app made with react and react-router from an old version to react 0.15 and react-router 2.0
In the old version the Links where created like this:
<Link to='route-name' query={{ids: [1]}}>
{name}
</Link>
This constructed a url like /route/?ids[]=1. That would give me in the component
this.props.query = {
ids: ['1']
}
After the upgrade the Link declaration was changed to:
<Link to={{pathname:`/route/`, query={ids: [1]}}}>
{name}
</Link>
Which produces urls like /route/ids=1, now the Router parses the querystring like this:
this.props.location.query = {
ids : '1'
}
The only way I've managed to get an array if is the array in the link declaration has more than one element, although the url doesn't use empty brackets in the url.
So is there a way to force the router to use an array when there is only a single element, I don't want to have to check every time if what I'm getting is an array or a string.