Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyal Keren committed Dec 5, 2023
1 parent 47a8172 commit c2194d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions backend/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bring http;

let react = new ex.ReactApp(
projectPath: "../client",
localPort: 4001
);

let api = new cloud.Api(
Expand Down
1 change: 1 addition & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<script src="./wing.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
25 changes: 13 additions & 12 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -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 (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
{title}
</header>
</div>
);
}

export default App;
export default App;

0 comments on commit c2194d6

Please sign in to comment.