# RupaPlayer

> `const` **RupaPlayer**: (`props`) => `ReactElement`

A `div` the `.rupaplay` file `src` is mounted into, after the render (on a server it renders the `div` alone). Its
`ref` is given the `Player` once the file is mounted, `null` before and after (`player.root` is the `div`, or the
element of the file's root class inside it). Unmounting destroys the player.

## Parameters

### props

[`RupaPlayerProps`](/reference/api/rupamotion/player/react/interfaces/rupaplayerprops/) & `RefAttributes`<[`Player`](/reference/api/rupamotion/player/interfaces/player/)<`string`>>

The file's props and the `div`'s (see `RupaPlayerProps`); `ref` receives the `Player`.

## Returns

`ReactElement`

The `div`.

## Example

```tsx
import { useRef } from "react";
import type { Player } from "@rupamotion/player";
import { RupaPlayer } from "@rupamotion/player/react";

export function Hero() {
	const player = useRef<Player>(null);
	return (
		<RupaPlayer
			ref={player}
			src="/hero.rupaplay"
			markup="auto"
			cloak
			onReady={(ready) => ready.play("intro")}
			onError={(error) => console.warn(error.code)}
		/>
	);
}
```
