Skip to content

Commit 698c00c

Browse files
feat(deps): update react to 19 (#2487)
* chore(deps): update react to 19 * fix: examples to show backwards compatibility with react 18 * fix: types * fix: eslint --------- Co-authored-by: Dylan Tientcheu <[email protected]>
1 parent 7f670b6 commit 698c00c

40 files changed

+203
-66
lines changed

examples/demo-react-18/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>DocSearch v3 - React</title>
9+
</head>
10+
11+
<body>
12+
<div id="root"></div>
13+
<script type="module" src="/src/main.tsx"></script>
14+
</body>
15+
16+
</html>

examples/demo-react-18/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@docsearch/react-18-example",
3+
"description": "DocSearch v3 React 18 example",
4+
"version": "3.8.3",
5+
"private": true,
6+
"license": "MIT",
7+
"type": "module",
8+
"scripts": {
9+
"dev": "vite",
10+
"build": "tsc -b && vite build",
11+
"preview": "vite preview"
12+
},
13+
"dependencies": {
14+
"@docsearch/css": "workspace:*",
15+
"@docsearch/react": "workspace:*",
16+
"react": "^18.0.0",
17+
"react-dom": "^18.0.0"
18+
},
19+
"devDependencies": {
20+
"@vitejs/plugin-react": "^4.3.4",
21+
"vite": "^6.0.7"
22+
}
23+
}
5.43 KB
Binary file not shown.

examples/demo-react-18/src/App.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
3+
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
4+
}

examples/demo-react-18/src/App.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { DocSearch } from '@docsearch/react';
2+
import React from 'react';
3+
import './App.css';
4+
import '@docsearch/css/dist/style.css';
5+
6+
function App(): React.JSX.Element {
7+
return (
8+
<div>
9+
<h1>DocSearch v3 - React - 18</h1>
10+
<DocSearch indexName="vuejs" appId="ML0LEBN7FQ" apiKey="21cf9df0734770a2448a9da64a700c22" insights={true} />
11+
</div>
12+
);
13+
}
14+
15+
export default App;

examples/demo-react-18/src/main.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint-disable react/react-in-jsx-scope */
2+
import { StrictMode } from 'react';
3+
import { createRoot } from 'react-dom/client';
4+
5+
import App from './App.tsx';
6+
7+
createRoot(document.getElementById('root')!).render(
8+
<StrictMode>
9+
<App />
10+
</StrictMode>,
11+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

examples/demo-react-18/tsconfig.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compilerOptions": {
3+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4+
"target": "ES2020",
5+
"useDefineForClassFields": true,
6+
"lib": [
7+
"ES2020",
8+
"DOM",
9+
"DOM.Iterable"
10+
],
11+
"module": "ESNext",
12+
"skipLibCheck": true,
13+
/* Bundler mode */
14+
"moduleResolution": "Bundler",
15+
"allowImportingTsExtensions": true,
16+
"isolatedModules": true,
17+
"moduleDetection": "force",
18+
"noEmit": true,
19+
"jsx": "react-jsx",
20+
/* Linting */
21+
"strict": true,
22+
"noUnusedLocals": true,
23+
"noUnusedParameters": true,
24+
"noFallthroughCasesInSwitch": true,
25+
"noUncheckedSideEffectImports": true
26+
},
27+
"include": [
28+
"src",
29+
"vite.config.ts"
30+
],
31+
}

examples/demo-react-18/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import react from '@vitejs/plugin-react';
2+
import { defineConfig } from 'vite';
3+
4+
// https://vite.dev/config/
5+
export default defineConfig({
6+
plugins: [react()],
7+
});

examples/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"dependencies": {
1414
"@docsearch/css": "3.8.3",
1515
"@docsearch/react": "3.8.3",
16-
"react": "^18.0.0",
17-
"react-dom": "^18.0.0"
16+
"react": "^19.0.0",
17+
"react-dom": "^19.0.0"
1818
},
1919
"devDependencies": {
2020
"@vitejs/plugin-react": "^4.3.4",

0 commit comments

Comments
 (0)