diff --git a/waspc/data/Generator/templates/react-app/src/index.js b/waspc/data/Generator/templates/react-app/src/index.js index f3c69fd0c..03c6e1136 100644 --- a/waspc/data/Generator/templates/react-app/src/index.js +++ b/waspc/data/Generator/templates/react-app/src/index.js @@ -13,9 +13,6 @@ import * as serviceWorker from './serviceWorker' {=# setupFn.isDefined =} {=& setupFn.importStatement =} {=/ setupFn.isDefined =} -{=# rootComponent.isDefined =} -{=& rootComponent.importStatement =} -{=/ rootComponent.isDefined =} startApp() @@ -37,13 +34,7 @@ async function render() { const queryClient = await queryClientInitialized ReactDOM.render( - {=# rootComponent.isDefined =} - <{= rootComponent.importIdentifier =}> - {=/ rootComponent.isDefined =} {router} - {=# rootComponent.isDefined =} - - {=/ rootComponent.isDefined =} , document.getElementById('root') ) diff --git a/waspc/data/Generator/templates/react-app/src/router.js b/waspc/data/Generator/templates/react-app/src/router.js index 896e3031a..ae2db5552 100644 --- a/waspc/data/Generator/templates/react-app/src/router.js +++ b/waspc/data/Generator/templates/react-app/src/router.js @@ -1,6 +1,9 @@ {{={= =}=}} import React from 'react' import { Route, BrowserRouter as Router } from 'react-router-dom' +{=# rootComponent.isDefined =} +{=& rootComponent.importStatement =} +{=/ rootComponent.isDefined =} {=# isAuthEnabled =} import createAuthRequiredPage from "./auth/pages/createAuthRequiredPage.js" @@ -16,11 +19,15 @@ import OAuthCodeExchange from "./auth/pages/OAuthCodeExchange" const router = ( -
+ {=# rootComponent.isDefined =} + <{= rootComponent.importIdentifier =}> + {=/ rootComponent.isDefined =} + {=^ rootComponent.isDefined =} + <> + {=/ rootComponent.isDefined =} {=# routes =} {=/ routes =} - {=# isExternalAuthEnabled =} {=# externalAuthProviders =} {=# authProviderEnabled =} @@ -30,7 +37,12 @@ const router = ( {=/ authProviderEnabled =} {=/ externalAuthProviders =} {=/ isExternalAuthEnabled =} -
+ {=# rootComponent.isDefined =} + + {=/ rootComponent.isDefined =} + {=^ rootComponent.isDefined =} + + {=/ rootComponent.isDefined =}
) diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums index e52682c81..c9b2c49ae 100644 --- a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums +++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums @@ -403,7 +403,7 @@ "file", "web-app/src/router.js" ], - "62928b69543a870338ab09c2f7493ec7594993bc4f2922052da3c3a9d804e0cd" + "70c9237cf961320f04d9736007a8ec3fbc1cd1adfe2cfbc5214cb2d91d57d503" ], [ [ diff --git a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/router.js b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/router.js index 695fa47e8..6d193e35e 100644 --- a/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/router.js +++ b/waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/router.js @@ -7,10 +7,9 @@ import MainPage from './ext-src/MainPage' const router = ( -
+ <> - -
+
) diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums index c58f9d854..702ea48dc 100644 --- a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums +++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums @@ -403,7 +403,7 @@ "file", "web-app/src/router.js" ], - "62928b69543a870338ab09c2f7493ec7594993bc4f2922052da3c3a9d804e0cd" + "70c9237cf961320f04d9736007a8ec3fbc1cd1adfe2cfbc5214cb2d91d57d503" ], [ [ diff --git a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/router.js b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/router.js index 695fa47e8..6d193e35e 100644 --- a/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/router.js +++ b/waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/web-app/src/router.js @@ -7,10 +7,9 @@ import MainPage from './ext-src/MainPage' const router = ( -
+ <> - -
+
) diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums index 4f23fa1f3..b8c52767c 100644 --- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums +++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/.waspchecksums @@ -417,7 +417,7 @@ "file", "web-app/src/router.js" ], - "62928b69543a870338ab09c2f7493ec7594993bc4f2922052da3c3a9d804e0cd" + "70c9237cf961320f04d9736007a8ec3fbc1cd1adfe2cfbc5214cb2d91d57d503" ], [ [ diff --git a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/router.js b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/router.js index 695fa47e8..6d193e35e 100644 --- a/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/router.js +++ b/waspc/e2e-test/test-outputs/waspJob-golden/waspJob/.wasp/out/web-app/src/router.js @@ -7,10 +7,9 @@ import MainPage from './ext-src/MainPage' const router = ( -
+ <> - -
+
) diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums index 3719b0fdc..6d66776fc 100644 --- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums +++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/.waspchecksums @@ -403,7 +403,7 @@ "file", "web-app/src/router.js" ], - "62928b69543a870338ab09c2f7493ec7594993bc4f2922052da3c3a9d804e0cd" + "70c9237cf961320f04d9736007a8ec3fbc1cd1adfe2cfbc5214cb2d91d57d503" ], [ [ diff --git a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/router.js b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/router.js index 695fa47e8..6d193e35e 100644 --- a/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/router.js +++ b/waspc/e2e-test/test-outputs/waspMigrate-golden/waspMigrate/.wasp/out/web-app/src/router.js @@ -7,10 +7,9 @@ import MainPage from './ext-src/MainPage' const router = ( -
+ <> - -
+
) diff --git a/waspc/examples/todoApp/src/client/App.jsx b/waspc/examples/todoApp/src/client/App.jsx index 319cb6e7a..3fd7c7d63 100644 --- a/waspc/examples/todoApp/src/client/App.jsx +++ b/waspc/examples/todoApp/src/client/App.jsx @@ -1,8 +1,9 @@ +import { Link } from 'react-router-dom' + import logout from '@wasp/auth/logout.js' import useAuth from '@wasp/auth/useAuth.js' import './Main.css' - export function App({ children }) { const { data: user } = useAuth() @@ -10,12 +11,12 @@ export function App({ children }) {

- ToDo App + ToDo App

{user && (
- Hello, {user.username} + Hello, {user.username}