I am working with React-Router in React-JS:
The
is an built in component and have two different props:
exact
and strict
If you use exact
and strict
together, then the location.pathname
will only match exactly as provided in path props.
Example:
Will only match /one
but not /one/
and /one/two
.
Example:
Will only match /one/
but not /one
and /one/two
.
If you use only strict
, then the location.pathname
will match which have trailing slash.
Example:
Will match /one/
and /one/two
but not /one
.
If you use only exact
, then the location.pathname
will match exact location path.
Example:
Will match /one
or /one/
. The exact
props doesn't care for trailing slash. But it will not match /one/two
.