<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Diogo Goncalves</title>
    <description>The latest articles on Forem by Diogo Goncalves (@diogo405).</description>
    <link>https://forem.com/diogo405</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F452474%2Fc7f6f279-dc4f-4754-86ec-b3b7b9086ea2.jpeg</url>
      <title>Forem: Diogo Goncalves</title>
      <link>https://forem.com/diogo405</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/diogo405"/>
    <language>en</language>
    <item>
      <title>I've made a Spotify clone with React, Redux, and Typescript</title>
      <dc:creator>Diogo Goncalves</dc:creator>
      <pubDate>Sat, 08 May 2021 03:29:51 +0000</pubDate>
      <link>https://forem.com/diogo405/i-ve-made-a-spotify-clone-with-react-redux-and-typescript-1fh2</link>
      <guid>https://forem.com/diogo405/i-ve-made-a-spotify-clone-with-react-redux-and-typescript-1fh2</guid>
      <description>&lt;p&gt;Hello everyone, I'm sharing this Spotify Clone that I made with React, Redux, and Typescript. If you wanna head straight to the live version you can click on this link: &lt;a href="http://spotifyclooone.netlify.app/" rel="noopener noreferrer"&gt;http://spotifyclooone.netlify.app/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0sh3c8yj68dmnzibfo92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0sh3c8yj68dmnzibfo92.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you wanna check the source code head to my Github by clicking here &lt;a href="https://github.com/diogo405/spotify-clone" rel="noopener noreferrer"&gt;https://github.com/diogo405/spotify-clone&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the project
&lt;/h2&gt;

&lt;p&gt;The project is actually very simple, it's just two pages: Home and Album that pull data from a fake API. &lt;/p&gt;

&lt;h2&gt;
  
  
  Redux &amp;amp; Typescript
&lt;/h2&gt;

&lt;p&gt;I'm not gonna lie if you are new to Typescript your chances to hate it gonna be 100%. Typing almost everything can be very painful for the first time. After a few components, you get used to it and sometimes it saves your ass. My advice is if you wanna taste Typescript start with a Javascript project, not React.&lt;/p&gt;

&lt;p&gt;Redux is another thing that's not very pleasant (I've always been a fan of Recoil - simple and easy). They are trying to reduce the boilerplate with the toolkit - and it's better now - but still, there's a lot to be coded to get/set your state (especially with Typescript).&lt;/p&gt;

&lt;h2&gt;
  
  
  Fake API
&lt;/h2&gt;

&lt;p&gt;The fake API is a set of async functions that return JSON files in a random interval of 0 to 3 secs. While the data is not ready, I'm using some skeletons as placeholders so the layout doesn't jump too much.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2aj1lq3dp34g3fttyou.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2aj1lq3dp34g3fttyou.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Experimenting with React and Typescript is very interesting as you learn a new way to develop with Javascript and familiarise yourself with a technology that I believe is gonna stay.&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>typescript</category>
      <category>spotify</category>
    </item>
    <item>
      <title>I've built a Netflix clone using React and TMDB API</title>
      <dc:creator>Diogo Goncalves</dc:creator>
      <pubDate>Fri, 02 Oct 2020 06:17:27 +0000</pubDate>
      <link>https://forem.com/diogo405/i-ve-built-a-netflix-clone-using-react-and-tmdb-api-1810</link>
      <guid>https://forem.com/diogo405/i-ve-built-a-netflix-clone-using-react-and-tmdb-api-1810</guid>
      <description>&lt;p&gt;Hey! I finally finished this Netflix clone (took me more time than I expected 😅) and uploaded to Netlify. You can check this out &lt;a href="https://joeflix.netlify.app/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk9br8n1igxsobh2b9cr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk9br8n1igxsobh2b9cr6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
My idea was to make everything static (movies, series, tv shows, ...) but then I found this really cool &lt;a href="https://developers.themoviedb.org/4/getting-started/authorization" rel="noopener noreferrer"&gt;TMDB API&lt;/a&gt; which you can pull most popular movies, top rated shows, what's trending, collections, lists and muuuch more. Really worth checking 👀&lt;/p&gt;

&lt;p&gt;After that, I wanted to use something to separate the UI state from the API data. I ended up using &lt;a href="https://react-query.tanstack.com/" rel="noopener noreferrer"&gt;React-Query&lt;/a&gt; to fetch the Movie API which I found really nice. You need to pass a key and a function to grab the data you want. It returns the API response, a flag indicating if it's loading and another one if there was an error or not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {data: heroData, isLoading: heroIsLoading, error: heroError} = useQuery('hero', async () =&amp;gt; {
    const res = await fetch(`${process.env.REACT_APP_TMDB_BASE_URL}/movie/558?api_key=${process.env.REACT_APP_TMDB_KEY}`)
    const data = await res.json()
    return data
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Components
&lt;/h2&gt;

&lt;p&gt;The hardest part was to build the home page. I had a look at Netflix website and thought what parts would be my React components.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frhysrsu4c8qrqezlvfri.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frhysrsu4c8qrqezlvfri.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the home page was built, I kind of developed the TV Shows and Movies page re-using what I had done before. The layout of each page is different but they still use the same components.&lt;/p&gt;

&lt;h2&gt;
  
  
  State Management
&lt;/h2&gt;

&lt;p&gt;At the beginning I thought I would use Context API but it needs to pass from parent to siblings (could've put as the root element but...). I tried to understand Redux and found a bit overwhelming 😬 My choice was &lt;a href="https://recoiljs.org/" rel="noopener noreferrer"&gt;Recoil&lt;/a&gt;, I'm using its basic hooks (useRecoilState, useSetRecoilState) and atoms. Didn't dive into selectors and others features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Stuff
&lt;/h2&gt;

&lt;p&gt;Lastly, for routing I'm using &lt;a href="https://reactrouter.com/web/guides/quick-start" rel="noopener noreferrer"&gt;React Router&lt;/a&gt; and Code-Splitting the page components in App.js.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const HomePage = React.lazy(() =&amp;gt; import('./pages/HomePage.js'));
const VideoPage = React.lazy(() =&amp;gt; import('./pages/VideoPage.js'));
const ShowsPage = React.lazy(() =&amp;gt; import('./pages/ShowsPage.js'));
const MoviesPage = React.lazy(() =&amp;gt; import('./pages/MoviesPage.js'));
...
&amp;lt;RecoilRoot&amp;gt;
    &amp;lt;Router&amp;gt;
        &amp;lt;FeedbackPopup/&amp;gt;
        &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;}&amp;gt;
            &amp;lt;Switch&amp;gt;
                &amp;lt;Route exact path="/"&amp;gt;
                    &amp;lt;Topbar/&amp;gt;
                    &amp;lt;HomePage/&amp;gt;
                &amp;lt;/Route&amp;gt;
                &amp;lt;Route path="/playing/:type/:id"&amp;gt;
                    &amp;lt;VideoPage/&amp;gt;
                &amp;lt;/Route&amp;gt;
                &amp;lt;Route path="/tv-shows"&amp;gt;
                    &amp;lt;Topbar/&amp;gt;
                    &amp;lt;ShowsPage/&amp;gt;
                &amp;lt;/Route&amp;gt;
                &amp;lt;Route path="/movies"&amp;gt;
                    &amp;lt;Topbar/&amp;gt;
                    &amp;lt;MoviesPage/&amp;gt;
                &amp;lt;/Route&amp;gt;
            &amp;lt;/Switch&amp;gt;
        &amp;lt;/Suspense&amp;gt;
    &amp;lt;/Router&amp;gt;
&amp;lt;/RecoilRoot&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can found the code at my &lt;a href="https://github.com/diogo405/joeflix" rel="noopener noreferrer"&gt;Github&lt;/a&gt;. Any feedback is very welcome 👍🏽&lt;/p&gt;

&lt;p&gt;Happy coding 😃&lt;/p&gt;

</description>
      <category>react</category>
      <category>netflix</category>
      <category>api</category>
    </item>
    <item>
      <title>I've made an Instagram clone with React</title>
      <dc:creator>Diogo Goncalves</dc:creator>
      <pubDate>Fri, 25 Sep 2020 01:07:45 +0000</pubDate>
      <link>https://forem.com/diogo405/i-ve-made-an-instagram-clone-with-react-fgn</link>
      <guid>https://forem.com/diogo405/i-ve-made-an-instagram-clone-with-react-fgn</guid>
      <description>&lt;p&gt;Hey, I hope you are having a great coding weekend 😃 &lt;/p&gt;

&lt;p&gt;Recently I've been studying React (I'm a Vue guy) and to sharpen my skills I decided to build an Instagram clone. You can check it live &lt;a href="https://theigclone.netlify.app/#/" rel="noopener noreferrer"&gt;here&lt;/a&gt;, it's on Netlify and if you wanna dig the code or contribute it's on my &lt;a href="https://github.com/diogo405/igclone" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdiogo405%2Figclone%2Fblob%2Fmaster%2Fsrc%2Fimages%2Fscreenshot-feed.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdiogo405%2Figclone%2Fblob%2Fmaster%2Fsrc%2Fimages%2Fscreenshot-feed.png%3Fraw%3Dtrue" title="IG Clone" alt="alt "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it Works
&lt;/h2&gt;

&lt;p&gt;The app has three pages: Feed, Comments and Stories. All the data is loaded from json files and drilled down from the page to the components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsiveness
&lt;/h2&gt;

&lt;p&gt;I made it max-width 414px so if you can check it on desktop and even older phones.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;I think it'd really cool to have a dark mode. Maybe when you click on the config icon it shows some options and a switch to  darkmode it.&lt;/p&gt;

&lt;p&gt;That's all, any feedback is appreciated.&lt;br&gt;
See ya ✌️&lt;/p&gt;

</description>
      <category>react</category>
      <category>instagram</category>
    </item>
  </channel>
</rss>
