feat(app): scaffold entry point — providers et router minimal
This commit is contained in:
parent
16a8bfbe41
commit
9c5e1d741b
3 changed files with 58 additions and 0 deletions
15
src/app/main.tsx
Normal file
15
src/app/main.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import { Providers } from './providers'
|
||||||
|
import '../index.css'
|
||||||
|
|
||||||
|
const container = document.getElementById('root')
|
||||||
|
if (!container) {
|
||||||
|
throw new Error('Root element #root introuvable dans index.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
createRoot(container).render(
|
||||||
|
<StrictMode>
|
||||||
|
<Providers />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
||||||
22
src/app/providers.tsx
Normal file
22
src/app/providers.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
|
import { AppRouter } from './router'
|
||||||
|
|
||||||
|
const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: 5 * 60 * 1000,
|
||||||
|
retry: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export function Providers() {
|
||||||
|
return (
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<BrowserRouter>
|
||||||
|
<AppRouter />
|
||||||
|
</BrowserRouter>
|
||||||
|
</QueryClientProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
21
src/app/router.tsx
Normal file
21
src/app/router.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { Routes, Route } from 'react-router-dom'
|
||||||
|
|
||||||
|
export function AppRouter() {
|
||||||
|
return (
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<ScaffoldPlaceholder />} />
|
||||||
|
</Routes>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ScaffoldPlaceholder() {
|
||||||
|
return (
|
||||||
|
<main className="p-6">
|
||||||
|
<h1 className="text-2xl font-semibold">Expria — scaffold Sprint 0</h1>
|
||||||
|
<p>
|
||||||
|
Aucune feature n'est encore branchée. Les routes seront ajoutées au fil
|
||||||
|
des sprints.
|
||||||
|
</p>
|
||||||
|
</main>
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue