Skip to content

Commit

Permalink
Upgrade React to 19 + other updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkiiski committed Dec 16, 2024
1 parent 6b31c5d commit e729c77
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 129 deletions.
175 changes: 71 additions & 104 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@
"homepage": "https://www.kalevalamitta.fi",
"dependencies": {
"@types/node": "^20.0.0",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.13",
"classnames": "^2.3.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"classnames": "^2.5.1",
"normalize.css": "^8.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.6.2"
"react": "^19.0.0",
"react-dom": "^19.0.0",
"typescript": "^5.7.2"
},
"scripts": {
"start": "vite",
"build": "vite build",
"preview": "vite preview",
"test": "vitest",
"lint": "eslint . --ext .ts,.tsx && prettier --check .",
"lint:fix": "eslint . --ext .ts,.tsx --fix && prettier --write ."
"lint": "tsc --noEmit && eslint . --ext .ts,.tsx && prettier --check .",
"lint:fix": "eslint . --ext .ts,.tsx --fix && prettier --write . && tsc --noEmit"
},
"prettier": "eslint-config-broilerplate/prettier.config",
"eslintConfig": {
"extends": [
"broilerplate/react",
"react-app/jest"
"broilerplate/react"
]
},
"browserslist": {
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Saa'ani sanelemahan.`;

function App() {
const [poem, setPoem] = useLocalState<string>('poem', '');
const editorRef = useRef<Focusable>();
const editorRef = useRef<Focusable>(null);

useEffect(() => {
// Auto-focus the editor
Expand Down
13 changes: 5 additions & 8 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React from 'react';
import { hydrate, render } from 'react-dom';
import React, { ReactNode } from 'react';
import { createRoot, hydrateRoot } from 'react-dom/client';
import App from './App';
import 'normalize.css/normalize.css';
import './index.css';

function renderApp(element: JSX.Element, rootElement: HTMLElement) {
if (rootElement.hasChildNodes()) {
hydrate(element, rootElement);
} else {
render(element, rootElement);
}
function renderApp(element: ReactNode, rootElement: HTMLElement) {
const root = rootElement.hasChildNodes() ? hydrateRoot(rootElement, element) : createRoot(rootElement);
root.render(element);
}

renderApp(
Expand Down
Loading

0 comments on commit e729c77

Please sign in to comment.