This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
const PORT = process.env.PORT || 3000; | |
const bodyParser = require("body-parser"); | |
const fetch = require("node-fetch"); | |
app.use(bodyParser.json()); | |
app.get("/", (req, res) => { | |
res.send("Hello World"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, Fragment } from 'react'; | |
import * as client from './OpenLibraryClient'; | |
import BooksList from './BooksList'; | |
import SearchForm from './SearchForm'; | |
class App extends Component { | |
state = { books: [], isFetching: false, query: '', numFound: 0 }; | |
onSearch = async e => { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Fragment, useState } from 'react'; | |
import * as client from './OpenLibraryClient'; | |
import BooksList from './BooksList'; | |
import SearchForm from './SearchForm'; | |
const App = () => { | |
const [isFetching, setIsFetching] = useState(false); | |
const [books, setBooks] = useState([]); | |
const [numFound, setNumFound] = useState(0); | |
const [query, setQuery] = useState(''); |