From 67f411a9e115b474f40567526a79374fa3bf221c Mon Sep 17 00:00:00 2001 From: Jeffrey Biles Date: Wed, 13 May 2020 10:52:00 -0700 Subject: [PATCH] Update redirect example syntax `routes` should be an array instead of an object --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cc51ca6e5..dcbf34d2a 100644 --- a/README.md +++ b/README.md @@ -60,18 +60,22 @@ These are technically breaking changes but they fix an inconsistent behavior. - Because of the change above, relative children path `redirect` on an empty path are not supported anymore. Use named routes instead: ```js // replace - let routes = { - path: '/parent', - children: [{ path: '', redirect: 'home' }, { path: 'home' }], - } + let routes = [ + { + path: '/parent', + children: [{ path: '', redirect: 'home' }, { path: 'home' }], + } + ] // with - let routes = { - path: '/parent', - children: [ - { path: '', redirect: { name: 'home' } }, - { path: 'home', name: 'home' }, - ], - } + let routes = [ + { + path: '/parent', + children: [ + { path: '', redirect: { name: 'home' } }, + { path: 'home', name: 'home' }, + ], + } + ] ``` Note this will work if `path` was `/parent/` as the relative location `home` to `/parent/` is indeed `/parent/home` but the relative location of `home` to `/parent` is `/home`