Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Amore joshamore

View GitHub Profile
View CONSTANTS.js
const CONSTANTS = {
database: {
connection_string: "",
},
auth: {
JWT_SECRET: "",
},
testing: {
@joshamore
joshamore / App.js
Last active Aug 28, 2020
Fetching data after page render with React Hooks
View App.js
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())
You can’t perform that action at this time.