Inertia.js

Provider and switcher

First of all, let's create a folder called providers inside the resources/js directory. Inside this folder, create a file called theme-provider.tsx. After that, you of course need a switcher right, so create a file called theme-switcher.tsx inside the components folder. So your folder structure now is like this:

resources/js
├── components
│   └── theme-switcher.tsx
│   └── ...
├── providers
│   └── theme-provider.tsx
│   ...
Loading source code...

Usage

Next, you'll use it inside the app.tsx file like this:

Loading source code...