[Link] Add prefetch="auto" option (#78689)
Adds a "auto" as a valid value for the `<Link>` component's prefetch
prop. It acts as an alias for the default behavior, i.e. same as no
prefetch prop at all.
---
A common source of confusion is the difference between `<Link>`, `<Link
prefetch={null}>`, and `<Link prefetch={boolean}>`:
- `prefetch={true}` → dynamically prefetch the whole page
- `prefetch={false}` → disable prefetching entirely
- no prop, `prefetch={null}`, `prefetch={undefined}` → default behavior
If you want to conditionally opt into dynamic prefetching, you have to
write something like this:
```
<Link prefetch={shouldDynamicallyPrefetch ? true : null}>
```
After this PR, you can do this instead:
```
<Link prefetch={shouldDynamicallyPrefetch ? true : 'auto'}>
```
It's still a bit confusing if you aren't aware of the subtleties of
dynamic versus static prefetching, but at least the "auto" string gives
slightly more of a hint that `true` is different from the default.
(In retrospect, we probably should have made `true` an alias for the
default, and chosen a separate value to opt into dynamic.)