Skip to content

Instantly share code, notes, and snippets.

@seanpmaxwell
Last active May 29, 2019 05:27
Show Gist options
  • Save seanpmaxwell/b09d1876245f982fbe92c6153b04ee22 to your computer and use it in GitHub Desktop.
Save seanpmaxwell/b09d1876245f982fbe92c6153b04ee22 to your computer and use it in GitHub Desktop.
TypeScriptFullStackShell/src/public/react/demo-react/src/App.tsx
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
async function callExpress() {
try {
let response = await fetch('/api/say-hello/SeanMaxwell')
.then(res => res.json());
alert('Hi this is a response from the backend: ' + response.response);
} catch (err) {
alert(err);
}
}
callExpress();
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment