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

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

React context and hook to use WebGPU with customizable loading and not supported messages.
https://github.com/kubohiroya/react-webgpu-context

react react-context react-hooks-library webgpu

Last synced: 7 months ago
JSON representation

React context and hook to use WebGPU with customizable loading and not supported messages.

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