return (
{child()?.localName}: {child()}
);
}
```
`resolveFirst` also accepts a custom predicate as a second argument. See [`Using a custom predicate`](#using-a-custom-predicate) section for more details.
## `[`
Get up-to-date reference to a single child element.
### How to use it
`][` accepts only a `ref` property for getting the current element or `undefined`, and requires `children` to be passed in.
```tsx
import { Ref } from "@solid-primitives/refs";
const [ref, setRef] = createSignal();
][{props.children}];
```
## ``
Get up-to-date references of the multiple children elements.
### How to use it
`` accepts only a `ref` property for getting the current array of elements, and requires `children` to be passed in.
```tsx
import { Refs } from "@solid-primitives/refs";
const [refs, setRefs] = createSignal([]);
{item => {item}
}
Hello
;
```
#### Demo
https://stackblitz.com/edit/solid-vite-unocss-bkbgap?file=index.tsx
(run `npm start` in the terminal)
## Types
### `Ref`
Type for the `ref` prop
```ts
export type Ref = T | ((el: T) => void) | undefined;
```
### `RefProps`
Component properties with types for `ref` prop
```ts
interface RefProps {
ref?: Ref;
}
```
## Changelog
See [CHANGELOG.md](./CHANGELOG.md)