Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Last active July 30, 2021 03:02
Show Gist options
  • Save MeetMartin/b96bf078ba895e608f1b70ca70050cbf to your computer and use it in GitHub Desktop.
Save MeetMartin/b96bf078ba895e608f1b70ca70050cbf to your computer and use it in GitHub Desktop.
// /src/pages/HomePage.js
import React, { useContext, useEffect } from 'react';
import { StoreContext } from '../store/StoreContext';
import { QuoteComponent, Background, Footer } from '../components';
const HomePage = () => {
const { state, actions } = useContext(StoreContext);
useEffect(() => {
setInterval(actions.requestRandomQuote, 10000);
}, []);
return (
<>
<Background />
<QuoteComponent quote={state.quote} author={state.author} />
<Footer />
</>
);
};
export default HomePage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment