From c2194d62f6609bec79df56fa8275773e041d75d2 Mon Sep 17 00:00:00 2001 From: Eyal Keren Date: Tue, 5 Dec 2023 20:52:33 +0200 Subject: [PATCH] fix --- backend/main.w | 1 + client/public/index.html | 1 + client/src/App.js | 25 +++++++++++++------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/backend/main.w b/backend/main.w index a8616a2..78dc422 100644 --- a/backend/main.w +++ b/backend/main.w @@ -5,6 +5,7 @@ bring http; let react = new ex.ReactApp( projectPath: "../client", + localPort: 4001 ); let api = new cloud.Api( diff --git a/client/public/index.html b/client/public/index.html index aa069f2..8e494e3 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -25,6 +25,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> React App + diff --git a/client/src/App.js b/client/src/App.js index 3784575..12c3b0f 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,25 +1,26 @@ import logo from './logo.svg'; +import {useEffect, useState} from "react"; import './App.css'; function App() { + const [title, setTitle] = useState("Default Value"); + const getTitle = async () => { + const response = await fetch(`${window.wingEnv.apiUrl}/title`); + setTitle(await response.text()); + } + + useEffect(() => { + getTitle(); + }, []); + return (
logo -

- Edit src/App.js and save to reload. -

- - Learn React - + {title}
); } -export default App; +export default App; \ No newline at end of file