Skip to content

Instantly share code, notes, and snippets.

View msojda's full-sized avatar
🎯
Focusing

Mateusz Sojda msojda

🎯
Focusing
View GitHub Profile
@msojda
msojda / index.js
Created April 3, 2018 09:18
Giphy chat bot
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");
});
@msojda
msojda / App.js
Last active January 13, 2019 09:45
React hooks App example
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();
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('');