molefrog / wouter

🥢 A minimalist-friendly ~2.1KB routing for React and Preact
https://npm.im/wouter
The Unlicense
6.65k stars 152 forks source link

v3: link with as child pattern #378

Closed jeetiss closed 10 months ago

jeetiss commented 11 months ago

<Link asChild /> feature

usage

// right

<Link to='href' ref={ref}>
  link
</Link>

<Link to='href' ref={ref} className={'hello'}>
  link
</Link>

<Link to='href' asChild>
  <Button>hello world</Button>
</Link>

<Link to='href' asChild>
  <Button ref={ref}>hello world</Button>
</Link>

// wrong

<Link to='href' asChild ref={ref} className={'noo'}>
  <Button ref={ref}>hello world</Button>
</Link>

<Link to='href' asChild>
  text
</Link>
codesandbox[bot] commented 11 months ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

stackblitz[bot] commented 11 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

github-actions[bot] commented 11 months ago

size-limit report 📦

Path Size
packages/wouter/esm/index.js 2.08 KB (+1.1% 🔺)
packages/wouter/esm/use-browser-location.js 658 B (0%)
packages/wouter/esm/memory-location.js 836 B (0%)
packages/wouter/esm/use-hash-location.js 734 B (0%)
packages/wouter-preact/esm/index.js 1.97 KB (+1.11% 🔺)
packages/wouter-preact/esm/use-browser-location.js 553 B (0%)
packages/wouter-preact/esm/use-hash-location.js 609 B (0%)
packages/wouter-preact/esm/memory-location.js 703 B (0%)
codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (cb714ce) 0.00% compared to head (e5e9e04) 100.00%. Report is 1 commits behind head on v3.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v3 #378 +/- ## ========================================= + Coverage 0 100.00% +100.00% ========================================= Files 0 1 +1 Lines 0 1 +1 ========================================= + Hits 0 1 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.