-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to react 18 #176
Upgrade to react 18 #176
Changes from 10 commits
1ba3be5
0262043
5fefcc7
edcae73
0470639
f7badae
35b04c6
7e0bce8
4e82ffa
15cdde3
44ba475
d0f903b
0af1185
fb63219
d61db26
53693eb
8cde88b
49cd2d1
e7ea50d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,12 @@ async function loadFramework(view: ViewMetadata): Promise<void> { | |
const externalLibsPath = libsPath + "node_modules/"; | ||
|
||
await loadScript(externalLibsPath + "prop-types/prop-types.min.js", view); /* Prop-Types */ | ||
await loadScript(externalLibsPath + "react/umd/react.production.min.js", view); /* React */ | ||
await loadScript(externalLibsPath + "react-dom/umd/react-dom.production.min.js", view); /* ReactDOM */ | ||
|
||
await loadScript(externalLibsPath + "react/umd/react.development.js", view); /* React */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not merge this |
||
await loadScript(externalLibsPath + "react-dom/umd/react-dom.development.js", view); /* ReactDOM */ | ||
define("react", [], () => window[reactLib]); | ||
define("react-dom", [], () => window[reactDOMLib]); | ||
define("react-dom/client", [], () => window[reactDOMLib]); | ||
} | ||
|
||
bootstrap(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from "react"; | ||
import { PropsWithChildren, useState, useEffect } from "react"; | ||
|
||
export interface IComponentWithMountCallbackProps { | ||
mounted?(): void; | ||
} | ||
|
||
export function ComponentWithMountCallback({ mounted, children }: PropsWithChildren<IComponentWithMountCallbackProps>): JSX.Element | null { | ||
const [isMounted, setIsMounted] = useState(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use ref... otherwise this leads to an extra render There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i actually wanted this way because I was getting a crash stating that there was a render after the hydration There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don get it... I stand with my opinion |
||
useEffect(() => { | ||
setIsMounted(true); | ||
mounted?.(); | ||
}, []); | ||
|
||
return isMounted ? <React.Fragment key={"asd"}>{children}</React.Fragment> : null; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
<AssemblyVersion>2.0.0.0</AssemblyVersion> | ||
<FileVersion>2.0.0.0</FileVersion> | ||
<Configurations>Debug;Release;ReleaseAvalonia;ReleaseWPF</Configurations> | ||
<EnableWindowsTargeting>true</EnableWindowsTargeting> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -102,10 +103,12 @@ | |
|
||
<ItemGroup> | ||
<EmbeddedResource Include="node_modules\react\umd\react.production.min.js" /> | ||
<EmbeddedResource Include="node_modules\react\umd\react.development.js" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not merge |
||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="node_modules\react-dom\umd\react-dom.production.min.js" /> | ||
<EmbeddedResource Include="node_modules\react-dom\umd\react-dom.development.js" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not merge