From 8c0d39d632d3a271f5afb0d810e8528ff3fa8e98 Mon Sep 17 00:00:00 2001 From: Cristin O'Connor Date: Mon, 28 Dec 2020 14:20:46 -0700 Subject: [PATCH] Fixing console warnings and errors --- src/App.js | 4 ++-- src/components/Deck/Deck.jsx | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/App.js b/src/App.js index bb1529a09..f915476b9 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,5 @@ import React from 'react'; -import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom"; +import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import NotFound from './components/NotFound/NotFound'; import Deck from './components/Deck/Deck'; import Theme from './Theme'; @@ -36,7 +36,7 @@ export const App = () => { -

Copyright ©2020  |  CRISTIN.IO

+

Copyright ©2020  |  CRISTIN.IO

diff --git a/src/components/Deck/Deck.jsx b/src/components/Deck/Deck.jsx index 58d4f8ff7..030476a50 100644 --- a/src/components/Deck/Deck.jsx +++ b/src/components/Deck/Deck.jsx @@ -38,15 +38,16 @@ const Deck = () => { } } - useEffect(() => { - if (!CardsContext.cards.length > 0) { + const loadContent = () => { + if (CardsContext.cards.length === 0) { CardsContext.getCards(); - } - - if (!CardsContext.categories.length > 0) { CardsContext.getCategories(); } - }, []); + } + + useEffect(() => { + loadContent(); + }); return (