Skip to content

Instantly share code, notes, and snippets.

const CONSTANTS = {
database: {
connection_string: "",
},
auth: {
JWT_SECRET: "",
},
testing: {
@joshamore
joshamore / App.js
Last active August 28, 2020 04:19
Fetching data after page render with React Hooks
import React, { useEffect } from "react";
function App() {
// Setting up the useEffect hook
// This will trigger on the first reload of the page thanks to the empty []
useEffect(() => {
// Fetching data
fetch("https://jsonplaceholder.typicode.com/todos/1")
// Converting response to a useable JSON format
.then((response) => response.json())