Skip to content

Instantly share code, notes, and snippets.

@franckjay
Created November 9, 2019 22:09
Show Gist options
  • Save franckjay/30551e12ccb1625b52987a414c204672 to your computer and use it in GitHub Desktop.
Save franckjay/30551e12ccb1625b52987a414c204672 to your computer and use it in GitHub Desktop.
import React, { useState, useEffect } from 'react';
import { Image } from "semantic-ui-react";
export const GrabBook = ()=> {
const [outputURL, setOutputURL] = useState("");
useEffect(() => {
fetch("/novel_novel").then(response =>
response.json().then(data => {
setOutputURL(data.image_url);
})
);
}, []);
const BookImage = () => (<Image src={outputURL} size='small' />)
console.log("reponse")
console.log(outputURL)
return(
<BookImage/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment