Skip to content

Commit c9c2224

Browse files
authored
Merge pull request #102 from Dagur/upgrade-to-react-18
Upgrade to React 18
2 parents 54c9940 + 143f99e commit c9c2224

File tree

10 files changed

+6189
-6021
lines changed

10 files changed

+6189
-6021
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"devDependencies": {
1717
"babel-eslint": "^10.1.0",
1818
"eslint": "^7.18.0",
19-
"eslint-config-react-app": "^6.0.0",
19+
"eslint-config-react-app": "^7.0.1",
2020
"eslint-plugin-flowtype": "^5.2.0",
2121
"eslint-plugin-import": "^2.22.1",
2222
"eslint-plugin-jsx-a11y": "^6.4.1",

packages/demo/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
"postbuild": "rimraf ../../gh-pages/static && cp -r build/* ../../gh-pages && rimraf build"
1111
},
1212
"dependencies": {
13-
"react": "^16.9.0",
14-
"react-bootstrap": "^0.32.4",
13+
"react": "^18.2.0",
14+
"react-bootstrap": "^0.33.1",
1515
"react-css-transition-replace": "*",
16-
"react-dom": "^16.9.0",
16+
"react-dom": "^18.2.0",
1717
"react-router-dom": "^5.0.1",
18-
"react-scripts": "3.1.2"
18+
"react-scripts": "5.0.1"
1919
},
2020
"eslintConfig": {
2121
"extends": "react-app"

packages/demo/src/Demo.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ import AnimatedRouter from './components/AnimatedRouter'
1212
import ContentLong from './components/ContentLong'
1313
import ContentShort from './components/ContentShort'
1414

15+
import vista1 from './img/vista1.jpg'
16+
import vista2 from './img/vista2.jpg'
17+
import vista3 from './img/vista3.jpg'
18+
import vista4 from './img/vista4.jpg'
19+
1520
class Demo extends React.Component {
1621
componentDidMount() {
17-
const images = ['img/vista1.jpg', 'img/vista2.jpg', 'img/vista3.jpg', 'img/vista4.jpg']
22+
const images = [vista1, vista2, vista3, vista4]
1823

1924
images.forEach((src) => {
2025
const img = new window.Image()
@@ -66,8 +71,8 @@ class Demo extends React.Component {
6671
transitionEnterTimeout={1000}
6772
transitionLeaveTimeout={1000}
6873
>
69-
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
70-
<img key="img2" src="img/vista2.jpg" width="600" height="280" alt="" />
74+
<img key="img1" src={vista1} width="600" height="235" alt="" />
75+
<img key="img2" src={vista2} width="600" height="280" alt="" />
7176
</ContentSwapper>
7277

7378
<h3 id="fade-wait">Fade out, then fade in transition</h3>
@@ -131,9 +136,9 @@ class Demo extends React.Component {
131136
transitionLeaveTimeout={2000}
132137
style={{ width: 600 }}
133138
>
134-
<img key="img1" src="img/vista3.jpg" width="600" height="255" alt="" />
135-
<img key="img2" src="img/vista4.jpg" width="600" height="280" alt="" />
136-
<img key="img3" src="img/vista2.jpg" width="600" height="290" alt="" />
139+
<img key="img1" src={vista3} width="600" height="255" alt="" />
140+
<img key="img2" src={vista4} width="600" height="280" alt="" />
141+
<img key="img3" src={vista2} width="600" height="290" alt="" />
137142
</ContentSwapper>
138143

139144
<h3 id="roll-up">Add/Remove Content</h3>
@@ -157,7 +162,7 @@ class Demo extends React.Component {
157162
transitionEnterTimeout={800}
158163
transitionLeaveTimeout={800}
159164
>
160-
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
165+
<img key="img1" src={vista1} width="600" height="235" alt="" />
161166
</ContentAddRemove>
162167

163168
<h3 id="height-and-width">Height and Width animation</h3>
@@ -175,7 +180,7 @@ class Demo extends React.Component {
175180
transitionLeaveTimeout={500}
176181
changeWidth
177182
>
178-
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
183+
<img key="img1" src={vista1} width="600" height="235" alt="" />
179184
</ContentAddRemove>
180185

181186
<h3 id="react-router-v4">React Router v4</h3>

packages/demo/src/components/AnimatedRouter.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
import React from 'react'
22
import ReactCSSTransitionReplace from 'react-css-transition-replace'
33
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'
4+
import vista2 from '../img/vista2.jpg'
5+
import vista3 from '../img/vista3.jpg'
6+
import vista4 from '../img/vista4.jpg'
47

58
const Home = () => (
69
<div>
710
<h2>Home</h2>
8-
<img src="img/vista3.jpg" width="600" height="255" alt="" />
11+
<img src={vista3} width="600" height="255" alt="" />
912
</div>
1013
)
1114

1215
const One = () => (
1316
<div>
1417
<h2>One</h2>
15-
<img src="img/vista4.jpg" width="600" height="280" alt="" />
18+
<img src={vista4} width="600" height="280" alt="" />
1619
</div>
1720
)
1821

1922
const Two = () => (
2023
<div>
2124
<h2>Two</h2>
22-
<img src="img/vista2.jpg" width="600" height="290" alt="" />
25+
<img src={vista2} width="600" height="290" alt="" />
2326
</div>
2427
)
2528

packages/demo/src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react'
2-
import ReactDOM from 'react-dom'
2+
import { createRoot } from 'react-dom/client'
33
import './index.css'
44
import './transitions.css'
55
import Demo from './Demo'
66

7-
ReactDOM.render(<Demo />, document.getElementById('root'))
7+
const container = document.getElementById('root')
8+
const root = createRoot(container)
9+
root.render(<Demo />)

0 commit comments

Comments
 (0)