diff --git a/src/components/Home.jsx b/src/components/Home.jsx index 2003e99e..4790ed43 100644 --- a/src/components/Home.jsx +++ b/src/components/Home.jsx @@ -1,8 +1,32 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import {Container, Header, Logo, Page, Search, About, AboutTitle, AboutContent, Boards, BoardsTitle, BoardsContent, Footer } from './styled/Home.styled'; const Home = () => { + const [defaultSubplebbits, setDefaultSubplebbits] = useState([]); + + /*const setDefaultSubplebbits = await fetch( + 'https://raw.githubusercontent.com/plebbit/temporary-default-subplebbits/master/subplebbits.json', + { cache: 'no-cache' } + ).then(res => res.json()); */ + + useEffect(() => { + let didCancel = false; + fetch( + "https://raw.githubusercontent.com/plebbit/temporary-default-subplebbits/master/subplebbits.json", + { cache: "no-cache" } + ) + .then((res) => res.json()) + .then(res => { + if (!didCancel) { + setDefaultSubplebbits(res); + } + }); + return () => { + didCancel = true; + }; + }, []); + return (
@@ -36,78 +60,17 @@ const Home = () => {

Popular boards

-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. + {defaultSubplebbits.map(subplebbit => ( +
+
{subplebbit.title}
+ + board logo + +
+ {subplebbit.address} +
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
-
-
Pleb whales
- - board logo - -
- p/plebwhales.eth: For those destined to make it. Minimum 1B PLEB in wallet to post. -
-
+ ))} @@ -121,7 +84,7 @@ const Home = () => { Donate
  • - Whitepaper + Whitepaper
  • Contract