-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
125 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
export default "/hello/:name"; | ||
// Route Functions give us full flexibility | ||
// This is a route similar to `/hello/:name` but with details impossible to achieve with a route string. | ||
export default ({ url }: { url: string }) => { | ||
if (!url.startsWith("/hello")) { | ||
return { match: false }; | ||
} | ||
const name = url.split("/")[2] || "anonymous"; | ||
return { match: true, contextProps: { name } }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
export default '/hello/:name' | ||
// Route Functions give us full flexibility | ||
// This is a route similar to `/hello/:name` but with details impossible to achieve with a route string. | ||
export default ({ url }: { url: string }) => { | ||
if (!url.startsWith('/hello')) { | ||
return { match: false } | ||
} | ||
const name = url.split('/')[2] || 'anonymous' | ||
return { match: true, contextProps: { name } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters