Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kubohiroya/react-webgpu-context

React context and hook to use WebGPU
https://github.com/kubohiroya/react-webgpu-context

Last synced: 16 days ago
JSON representation

React context and hook to use WebGPU

Awesome Lists containing this project

README

        

# react-webgpu-context
React context and hook to use WebGPU with customizable loading and not supported messages.

## Installation
```bash
pnpm install react-webgpu-context
```

### App.tsx
```tsx
import { WebGPUDeviceContextProvider } from 'react-webgpu-context';
import {MyWebGPUApp} from './MyWebGpuApp'
export const App = ()=>{
return (
Loading...)}
notSupportedMessage={(

WebGPU is not supported on this browser.

)}>


);
}
```

### MyWebGpuApp.tsx
```tsx
import { useWebGPUDevice } from 'react-webgpu-context';

export const MyWebGPUApp = ()=>{
const device: GPUDevice = useWebGPUDevice();
// use device to create render pipeline, buffers, etc.
}
```
## Author
- [Hiroya Kubo](https://github.com/kubohiroya)

## License
MIT