# useInitialValue
> Captures and returns the initial value of a prop, ignoring subsequent changes.

Captures and preserves the value from the initial render, ignoring all subsequent changes.
Useful when you need to reference a prop's original value throughout the component's lifecycle.

## Import

```js
import { useInitialValue } from '@volue/wave-react';
```

## Example

```jsx
() => {
  const [count, setCount] = React.useState(0);
  const initialCount = useInitialValue(count);

  return (
    <Flex flow="column" cross="start">
      <Text>{'Current count: ' + count}</Text>
      <Text>{'Initial count: ' + initialCount}</Text>
      <Button onClick={() => setCount(c => c + 1)}>{'Increment'}</Button>
    </Flex>
  );
};
```

---

## API reference

### Arguments

| Name    | Type             | Default | Description                                                                        | Required |
| ------- | ---------------- | ------- | ---------------------------------------------------------------------------------- | -------- |
| `value` | `T \| (() => T)` | `—`     | The value to capture on initial render. Can be a value or an initialiser function. | Yes      |

### Returns

`T` — The value from the initial render, which remains constant regardless of subsequent prop changes.
