Linking Routes
Edit this pageOnce routes have been created within an application, using anchor tags will help users navigate between different views or pages.
<A>
Component
Solid Router also offers an <A>
component.
Similar to the HTML anchor tag, the <A>
component is similar but it supports automatically applying the base URL path and the relative paths.
In addition, the <A>
component has an active
class if its href
matches the current location, and inactive
otherwise.
This provides the link with a CSS class to show when the link is active or inactive.
By default, matching using the <A>
component includes locations that are descendants (eg. /users
and /users/123
).
This component offers the end
prop, which takes in a boolean to prevent matching these.
This can be useful when links to the root route (/
) would match everything.