# usePreviousValue
> Tracks and returns the previous value of a prop or state.

Tracks and returns the value from the previous render. Useful for comparing current and previous values to trigger transitions or conditional logic.

## Import

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

## Example

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

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

---

## API reference

### Arguments

| Name    | Type | Default | Description                 | Required |
| ------- | ---- | ------- | --------------------------- | -------- |
| `value` | `T`  | `—`     | The current value to track. | Yes      |

### Returns

`T`
