Route
"Its most basic responsibility is to render a specific component when a location matches the route’s path."
Component Settings
- Default Component settings
- Path - Specifies the pathname to be matched for the Route
- Exact match - Specifies if the match for the Path is to be exact
- Default Path - Specifies the default path for the Route
Path
String
If a Route's path matches the current location, it's children Components will be rendered.
To determine if a Route component's path prop matches the current location, the path-to-regexp
package is used. It compiles de path string into a regular expression which is matched against the current location pathname.
Exact match
boolean
Presented by a checkbox, the option Exact match assures that the match is equal to the Path defined.
Default path
String
Sets the default path for that Route. When using params such as /user/:userid
if the userid in the current location is not matched, the default path will be returned.
References
- React Route -reacttraining.com
- path-to-regexp -github.com/pillarjs/path-to-regexp