Skip to content

Commit

Permalink
upgrade to react 19
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Apr 26, 2024
1 parent 796317d commit 7de49f9
Show file tree
Hide file tree
Showing 43 changed files with 1,288 additions and 3,616 deletions.
86 changes: 43 additions & 43 deletions epicshop/package-lock.json

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

8 changes: 6 additions & 2 deletions epicshop/update-deps.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
npx npm-check-updates --dep prod,dev --upgrade --root
rm -rf node_modules package-lock.json ./exercises/**/node_modules
set -e

npx npm-check-updates --dep prod,dev --upgrade --root --reject react,react-dom
cd epicshop && npx npm-check-updates --dep prod,dev --upgrade --root
cd ..
rm -rf node_modules package-lock.json ./epicshop/package-lock.json ./epicshop/node_modules ./exercises/**/node_modules
npm install
npm run setup
npm run typecheck
Expand Down
7 changes: 5 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/** @type {import('@types/eslint').Linter.Config} */
export default {
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
languageOptions: { parser: await import('@typescript-eslint/parser') },
plugins: {
'@typescript-eslint': (await import('@typescript-eslint/eslint-plugin'))
.default,
'react-hooks': (await import('eslint-plugin-react-hooks')).default,
import: (await import('eslint-plugin-import')).default,
},
rules: {
// playwright requires destructuring in fixtures even if you don't use anything 🤷‍♂️
'no-empty-pattern': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',

'@typescript-eslint/consistent-type-imports': [
'warn',
{
Expand Down
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/01.problem.use-state/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -64,4 +64,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -64,4 +64,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/02.problem.control/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -80,4 +80,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/02.solution.control/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -85,4 +85,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/03.problem.derive/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -95,4 +95,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/03.solution.derive/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -92,4 +92,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/04.problem.init/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -96,4 +96,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/04.solution.init/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function App() {
Expand Down Expand Up @@ -95,4 +95,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/05.problem.cb/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

// 🐨 make a function here called getQueryParam
Expand Down Expand Up @@ -100,4 +100,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/01.managing-ui-state/05.solution.cb/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'

function getQueryParam() {
Expand Down Expand Up @@ -97,4 +97,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/02.side-effects/01.problem.effects/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'
import { setGlobalSearchParams } from '#shared/utils'

Expand Down Expand Up @@ -109,4 +109,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/02.side-effects/01.solution.effects/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'
import { setGlobalSearchParams } from '#shared/utils'

Expand Down Expand Up @@ -108,4 +108,4 @@ function MatchingPosts({ query }: { query: string }) {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<App />)
createRoot(rootEl).render(<App />)
4 changes: 2 additions & 2 deletions exercises/02.side-effects/02.problem.cleanup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'
import { setGlobalSearchParams } from '#shared/utils'

Expand Down Expand Up @@ -138,4 +138,4 @@ function DemoApp() {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<DemoApp />)
createRoot(rootEl).render(<DemoApp />)
4 changes: 2 additions & 2 deletions exercises/02.side-effects/02.solution.cleanup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import * as ReactDOM from 'react-dom/client'
import { createRoot } from 'react-dom/client'
import { generateGradient, getMatchingPosts } from '#shared/blog-posts'
import { setGlobalSearchParams } from '#shared/utils'

Expand Down Expand Up @@ -141,4 +141,4 @@ function DemoApp() {

const rootEl = document.createElement('div')
document.body.append(rootEl)
ReactDOM.createRoot(rootEl).render(<DemoApp />)
createRoot(rootEl).render(<DemoApp />)
Loading

0 comments on commit 7de49f9

Please sign in to comment.