Add
<!doctype html>
On the top of your view.
Using Laravel 12 + React in Inertia Hello everyone, please help me i can't find where i go wrong, btw beginner here I have a single page (BulkUploader.jsx) template that cant show when i try to navigate it via link and when i open it in new tab its only white, my other page templates works but only this one doesnt so I think its not the lack of Doctype that causes it.
Here are my src if it helps:
web.php
use App\Http\Controllers\Admin\DashboardController; use App\Http\Controllers\Admin\StudentController; use App\Http\Controllers\Admin\BulkUploadController; use App\Http\Controllers\ProfileController; use Illuminate\Foundation\Application; use Illuminate\Support\Facades\Route; use Inertia\Inertia; use App\Http\Controllers\VoterController;
Route::redirect('/', '/login');
Route::prefix('admin')->name('admin.')->middleware(['auth', 'verified', 'role:admin'])->group(function () { Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard'); Route::resource('students', StudentController::class);
// Bulk upload route
Route::get('students/bulk-upload', [BulkUploadController::class, 'index'])
->name('students.bulk-upload');
});
Route::middleware(['auth', 'verified', 'role:voter'])->group(function () { Route::get('/voter/dashboard', [VoterController::class, 'dashboard'])->name('voter.dashboard');
});
Route::middleware('auth')->group(function () { Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit'); Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update'); Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); });
require DIR . '/auth.php';
BulkUploader.jsx
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; import { Head } from '@inertiajs/react';
export default function BulkUploader() { return ( <AuthenticatedLayout header={ <h2 className="text-xl font-semibold leading-tight text-gray-800 dark:text-white"> Bulk Uploader } > <Head title="Students" />
<div className="">
<div className="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div className="overflow-hidden bg-white dark:bg-gray-800 shadow-sm sm:rounded-lg">
<div className="p-6 text-gray-900 dark:text-white">
Bulk
</div>
</div>
</div>
</div>
</AuthenticatedLayout>
);
}
BulkUploadController.php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request; use Inertia\Inertia; use App\Http\Controllers\Controller;
class BulkUploadController extends Controller { public function index() { return Inertia::render("Admin/Students/BulkUploader"); } }
Please or to participate in this conversation.