inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.02k stars 405 forks source link

Link component cannot be rendered as a custom component due to toLowerCase() #1844

Closed ghost closed 2 months ago

ghost commented 2 months ago

Version:

Describe the problem:

https://github.com/inertiajs/inertia/blob/2ebd86224d2c12fdad4e4b23276129832754cf6d/packages/react/src/Link.ts#L114

Because of the above line, it is not possible to use a custom component in the "as" of a Link component. Otherwise, it would be possible to use it as shown below:

import { Link } from '@inertiajs/react';
import { Button } from './components';

...
<Link as={Button}>Foo</Link>
...

Would it be possible to remove the above line to enable this use case?

Originally brought up by @bobbypiper in https://github.com/inertiajs/inertia/discussions/998

driesvints commented 2 months ago

Heya thank you for this issue. This is more a feature request so I suggest to just attempt a PR to see if it gets accepted.