The asAnchor HOC allows a parent application to style another component as an anchor.
This is so that the parent application can use react router and can pass in ReactRouter.Link to be styled, without introducing react-router as a dependency of govuk-react.
In turn this keeps govuk-react router agnostic, so that it could be used with reach-router etc.
This pattern is not scalable. We don't want to export loads of HOCs from the route of govuk-react, and if we did would have to come up with a unique name for each.
We also have an issue of how we deal with NavLink and it's active class that is not passed as a prop, how to pick this up with govuk-react while still being router agnostic.
This ticket is to track
(1) formalising a standard
(2) including the standard in the readme
(3) implementing it across govuk-react
The asAnchor HOC allows a parent application to style another component as an anchor.
This is so that the parent application can use react router and can pass in ReactRouter.Link to be styled, without introducing react-router as a dependency of govuk-react.
In turn this keeps govuk-react router agnostic, so that it could be used with reach-router etc.
This pattern is not scalable. We don't want to export loads of HOCs from the route of govuk-react, and if we did would have to come up with a unique name for each.
We also have an issue of how we deal with NavLink and it's active class that is not passed as a prop, how to pick this up with govuk-react while still being router agnostic.
This ticket is to track
(1) formalising a standard
(2) including the standard in the readme
(3) implementing it across govuk-react