diff --git a/packages/learn/src/pages/404.js b/packages/learn/src/pages/404.js index 854b91b9462a14..6b83ea399233da 100644 --- a/packages/learn/src/pages/404.js +++ b/packages/learn/src/pages/404.js @@ -1,33 +1,61 @@ import React from 'react'; import Helmet from 'react-helmet'; +import Spinner from 'react-spinkit'; import { Link } from 'gatsby'; import './404.css'; import notFoundLogo from '../../static/img/freeCodeCamp-404.svg'; import { quotes } from '../../static/json/quotes.json'; -let randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; +class NotFoundPage extends React.Component { + constructor(props) { + super(props); + this.state = { + randomQuote: null + } + } -const NotFoundPage = () => ( -
We couldn't find what you were looking for, but here is a quote:
+ updateQuote() { + this.setState({ + randomQuote: quotes[Math.floor(Math.random() * quotes.length)] + }); + } -- “ - {randomQuote.quote} -
-- {randomQuote.author}
-+ We couldn't find what you were looking for, but here is a + quote: +
++ “ + {this.state.randomQuote.quote} +
+- {this.state.randomQuote.author}
+