Skip to content

Instantly share code, notes, and snippets.

Avatar
☃️
Tis the season

RachelElysia

☃️
Tis the season
View GitHub Profile
@RachelElysia
RachelElysia / favoritebutton.js
Created February 26, 2021 23:43
Favorite Button Component
View favoritebutton.js
"use strict";
import styles from '../styles/Home.module.css';
import React, { useState, useEffect } from 'react';
import useSWR from 'swr'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHeart, faHeartBroken } from '@fortawesome/free-solid-svg-icons'
// Separate all fetches because render hooks has an issue with rendering
// hooks a different amount of times in the same component
@RachelElysia
RachelElysia / gist:c34bc386b9e3a603d29ef4890018027d
Created February 26, 2021 23:42
Favorite Button Component (/components/favoritebutton.js)
View gist:c34bc386b9e3a603d29ef4890018027d
"use strict";
import styles from '../styles/Home.module.css';
import React, { useState, useEffect } from 'react';
import useSWR from 'swr'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHeart, faHeartBroken } from '@fortawesome/free-solid-svg-icons'
// Separate all fetches because render hooks has an issue with rendering
// hooks a different amount of times in the same component