import React from "react"
import { Link as ReactRouterLink } from "react-router-dom"
import { BraidProvider, makeLinkComponent } from "braid-design-system"
import wireframe from "braid-design-system/themes/wireframe"
// First create the custom link implementation:
const CustomLink = makeLinkComponent(({ href, ...restProps }, ref) =>
href[0] === "/" ? (
<ReactRouterLink ref={ref} to={href} {...restProps} />
) : (
<a ref={ref} href={href} {...restProps} />
)
)
// Then pass it to BraidProvider:
export const App = () => (
<BraidProvider theme={wireframe} linkComponent={CustomLink}>
...
</BraidProvider>
)