next routes sequence like :
routes.add({
name: 'index',
pattern: '/',
page: 'index'
});
routes.add({
name: 'users',
pattern: '/:user',
page: 'users'
});
sometimes I get the error when I enter the index error message: Expected "user" to be a string
error path to regexp module
throw new TypeError('Expected "' + token.name + '" to be ' + (token.repeat ? 'an array' : 'a string')
Error section in next routes:
key: 'getAs',
value: function getAs() {
var _this5 = this;
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var as = this.toPath(params) || '/';
var keys = Object.keys(params);
var qsKeys = keys.filter(function (key) {
return _this5.keyNames.indexOf(key) === -1;
});
The message would make sense if you linked to route='users' without a user param. If it's happening elsewhere please provide some steps to reproduce
I had a similar error with that route:
routes.add('office', '/(office|cabinet)/:office');
I had to change from
<Link route="office" params={{ office: 'robert' }}>
to
<Link route="office" params={{ office: 'robert', 0: 'cabinet' }}>
Thanks for the tip fridays!
Most helpful comment
I had a similar error with that route:
I had to change from
<Link route="office" params={{ office: 'robert' }}>to
<Link route="office" params={{ office: 'robert', 0: 'cabinet' }}>Thanks for the tip fridays!