Documentation Index
Fetch the complete documentation index at: https://mintlify.com/devhammed/react-gtk/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before installing React GTK, ensure you have the following dependencies installed on your system:GJS runtime
GJS runtime
GJS is the GNOME JavaScript runtime that provides JavaScript bindings for GNOME libraries including GTK.Install on Ubuntu/Debian:Install on Fedora:Install on Arch Linux:Verify installation:
GTK 4.0
GTK 4.0
GTK 4.0 is required for React GTK to work. Most modern Linux distributions include GTK 4.Install on Ubuntu/Debian:Install on Fedora:Install on Arch Linux:
GTK 4.0 or later is required. React GTK does not support GTK 3.x.
Node.js and npm
Node.js and npm
Node.js is required for building your React GTK applications with bundlers.Install Node.js 16.x or later:
- Download from nodejs.org
- Or use a version manager like nvm
Install React GTK
Once you have the prerequisites installed, you can add React GTK to your project.Install React GTK and React
Install the
react-gtk-renderer package along with React:React GTK requires React 18.0 or higher as a peer dependency.
Project setup
After installation, set up your project structure and configuration files.TypeScript configuration
Create atsconfig.json file in your project root:
tsconfig.json
Package.json scripts
Add build and run scripts to yourpackage.json:
package.json
Project structure
Create the following directory structure:Verify installation
To verify that everything is installed correctly, create a simple test file:src/index.tsx
If the window appears, congratulations! React GTK is installed and working correctly.
Troubleshooting
GJS not found
GJS not found
If you get an error that
gjs command is not found:- Ensure GJS is installed:
sudo apt install gjs(or equivalent for your distro) - Verify it’s in your PATH:
which gjs - Check the version:
gjs --version
GTK 4.0 not found
GTK 4.0 not found
If you get errors about missing GTK 4.0:
- Install GTK 4 development packages:
sudo apt install libgtk-4-1 libgtk-4-dev - Verify installation:
pkg-config --modversion gtk4
Build errors with Parcel
Build errors with Parcel
If Parcel fails to build:
- Ensure you have all Parcel plugins installed:
- Clear Parcel cache:
rm -rf .parcel-cache - Try rebuilding:
npm run clean && npm run build
TypeScript errors
TypeScript errors
If you get TypeScript errors:
- Ensure
tsconfig.jsonhas"jsx": "react" - Check that React types are available (they’re included with React 18+)
- Verify
react-gtk-rendererincludes its type definitions
Next steps
Quickstart tutorial
Build your first React GTK application with a step-by-step tutorial
Core concepts
Learn how React GTK renders components and manages widgets
GTK components
Explore all available GTK widgets as React components
Examples
See complete example applications
