Skip to content

Instantly share code, notes, and snippets.

Avatar
🌦️
Rainbow season

RachelElysia

🌦️
Rainbow season
View GitHub Profile
@RachelElysia
RachelElysia / favoritebutton.js
Created Feb 26, 2021
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 Feb 26, 2021
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