new RouteRequirement(name, childRequirements, test, onFail)
A helper class to define a requirement that is needed to enter a route. Instances of this
class can be passed to Route components using the requirements prop
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | A name used for debugging purposes |
childRequirements |
Array.<RouteRequirement> | An array of other RouteRequirement instances. The child requirements will always be checked before this one. |
test |
function | A function that checks if the requirement is met. Receives the following parameters:
|
onFail |
function | A function that will be executed when the requirement is not met. Receives the following parameters:
|