glodrei
Version:
useful add-ons for react-three-fiber
28 lines (19 loc) • 680 B
text/mdx
title: Stats
sourcecode: src/core/Stats.tsx
[](https://drei.vercel.app/?path=/story/misc-stats--default-story)
Adds [stats](https://github.com/mrdoob/stats.js/) to document.body. It takes over the render-loop!
```jsx
<Stats showPanel={0} className="stats" {...props} />
```
You can choose to mount Stats to a different DOM Element - for example, for custom styling:
```jsx
const node = useRef(document.createElement('div'))
useEffect(() => {
node.current.id = 'test'
document.body.appendChild(node.current)
return () => document.body.removeChild(node.current)
}, [])
return <Stats parent={parent} />
```