Open History to see the last commit
1import { createSignal, onMount } from 'solid-js'
2import { Hydrate } from '@tanstack/solid-start'
3import { interaction, media } from '@tanstack/solid-start/hydration'
4β
5function CrossFileNestedButton() {
6 const [count, setCount] = createSignal(0)
7 const [hydrated, setHydrated] = createSignal(false)
8β
9 onMount(() => {
10 setHydrated(true)
11 })
12β
13 return (
14 <button
15 data-testid="enhanced-cross-file-nested-button"
16 data-hydrated={hydrated() ? 'true' : 'false'}
17 onClick={() => setCount((prev) => prev + 1)}
18 >
19 cross-file nested child:{' '}
20 <span data-testid="enhanced-cross-file-nested-count">{count()}</span>
21 </button>
22 )
23}
24β
25export function EnhancedNestedWidget() {
26 return (
27 <Hydrate when={media('(max-width: 1px)')}>
28 <Hydrate when={interaction({ events: 'click' })}>
29 <CrossFileNestedButton />
30 </Hydrate>
31 </Hydrate>
32 )
33}