Skip to content

Commit ad2c209

Browse files
feat(deps): Allowed support for React 19 (#282)
* feat(deps): Allowed support for React 19 * Updated comment syntax
1 parent 88bd5bc commit ad2c209

File tree

199 files changed

+610
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+610
-674
lines changed

.eslintrc.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"plugin:react/recommended",
1010
"plugin:react-hooks/recommended",
1111
"plugin:@typescript-eslint/recommended",
12+
"plugin:react/jsx-runtime",
1213
"prettier"
1314
],
1415
"overrides": [
@@ -31,13 +32,7 @@
3132
"version": "detect"
3233
}
3334
},
34-
"plugins": [
35-
"react",
36-
"react-hooks",
37-
"@typescript-eslint",
38-
"patternfly-react",
39-
"prettier"
40-
],
35+
"plugins": ["react", "react-hooks", "@typescript-eslint", "patternfly-react", "prettier"],
4136
"rules": {
4237
"@typescript-eslint/adjacent-overload-signatures": "error",
4338
"@typescript-eslint/array-type": "error",

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ To use Topology out of the box, follow these steps:
7878
## Example
7979

8080
```ts
81-
import * as React from 'react';
81+
import { memo, useState, useMemo } from 'react';
8282
import {
8383
EdgeStyle,
8484
Model,
@@ -172,10 +172,10 @@ const EDGES = [
172172
}
173173
];
174174

175-
export const TopologyBaselineDemo = React.memo(() => {
176-
const [selectedIds, setSelectedIds] = React.useState<string[]>([]);
175+
export const TopologyBaselineDemo = memo(() => {
176+
const [selectedIds, setSelectedIds] = useState<string[]>([]);
177177

178-
const controller = React.useMemo(() => {
178+
const controller = useMemo(() => {
179179
const model: Model = {
180180
nodes: NODES,
181181
edges: EDGES,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom';
1+
import { createRoot } from 'react-dom/client';
32
import App from './App';
43

54
it('renders without crashing', () => {
65
const div = document.createElement('div');
7-
ReactDOM.render(<App />, div);
8-
ReactDOM.unmountComponentAtNode(div);
6+
const root = createRoot(div);
7+
root.render(<App />);
8+
root.unmount();
99
});

packages/demo-app-ts/src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import { createElement } from 'react';
22
import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
33
import {
44
Page,
@@ -81,7 +81,7 @@ class App extends React.Component<{}, AppState> {
8181
style={{ zIndex: 2 }}
8282
id={`/${demo.id}-nav-link/${subDemo.id}-nav-link`}
8383
>
84-
{React.createElement(subDemo.componentType)}
84+
{createElement(subDemo.componentType)}
8585
</PageSection>
8686
)}
8787
key={demo.id}
@@ -94,7 +94,7 @@ class App extends React.Component<{}, AppState> {
9494
path={`/${demo.id}-nav-link`}
9595
render={() => (
9696
<PageSection isFilled hasBodyWrapper={false} style={{ zIndex: 2 }} id={`/${demo.id}-page-section`}>
97-
{React.createElement(demo.componentType)}
97+
{createElement(demo.componentType)}
9898
</PageSection>
9999
)}
100100
key={demo.id}
@@ -108,7 +108,7 @@ class App extends React.Component<{}, AppState> {
108108
path="/"
109109
render={() => (
110110
<PageSection isFilled hasBodyWrapper={false} style={{ zIndex: 2 }} id={`/${defaultDemo.id}-page-section`}>
111-
{React.createElement(defaultDemo.componentType)}
111+
{createElement(defaultDemo.componentType)}
112112
</PageSection>
113113
)}
114114
key={defaultDemo.id}

packages/demo-app-ts/src/components/CustomCircleNode.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from 'react';
1+
import { useEffect } from 'react';
22
import { observer } from 'mobx-react';
33
import {
44
WithCreateConnectorProps,
@@ -28,7 +28,7 @@ type CustomCircleNodeProps = {
2828

2929
const CustomCircle: React.FunctionComponent<ShapeProps> = ({ element, className }) => {
3030
useAnchor(EllipseAnchor);
31-
React.useEffect(() => {
31+
useEffect(() => {
3232
// init height
3333
element.setDimensions(new Dimensions(40, 40));
3434
}, [element]);

packages/demo-app-ts/src/components/CustomPathNode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import { observer } from 'mobx-react';
32
import {
43
WithCreateConnectorProps,

packages/demo-app-ts/src/components/CustomPolygonNode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import { observer } from 'mobx-react';
32
import {
43
WithCreateConnectorProps,

packages/demo-app-ts/src/components/CustomRectNode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import { observer } from 'mobx-react';
32
import {
43
WithCreateConnectorProps,

packages/demo-app-ts/src/components/DemoDefaultEdge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from 'react';
1+
import { useState } from 'react';
22
import { observer } from 'mobx-react';
33
import {
44
Edge,
@@ -25,7 +25,7 @@ interface BendpointProps {
2525
}
2626

2727
const Bendpoint: React.FunctionComponent<BendpointProps> = observer(({ point }) => {
28-
const [hover, setHover] = React.useState(false);
28+
const [hover, setHover] = useState(false);
2929
const [, ref] = useBendpoint(point);
3030
return (
3131
<circle

packages/demo-app-ts/src/components/DemoDefaultGroup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from 'react';
1+
import { useRef } from 'react';
22
import { observer } from 'mobx-react';
33
import {
44
useCombineRefs,
@@ -39,7 +39,7 @@ const DemoDefaultGroup: React.FunctionComponent<GroupProps> = ({
3939
}) => {
4040
const nodeElement = element as Node;
4141
useAnchor(RectAnchor);
42-
const boxRef = React.useRef<Rect | null>(null);
42+
const boxRef = useRef<Rect | null>(null);
4343
const refs = useCombineRefs<SVGRectElement>(dragNodeRef, dndDragRef, dndDropRef);
4444

4545
if (!droppable || !boxRef.current) {

0 commit comments

Comments
 (0)