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.
- Host: GitHub
- URL: https://github.com/kubohiroya/react-webgpu-context
- Owner: kubohiroya
- License: mit
- Created: 2024-12-26T01:06:38.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-12-26T03:34:54.000Z (12 months ago)
- Last Synced: 2025-04-26T20:06:28.475Z (8 months ago)
- Topics: react, react-context, react-hooks-library, webgpu
- Language: TypeScript
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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