<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Talade on Medium]]></title>
        <description><![CDATA[Stories by Talade on Medium]]></description>
        <link>https://medium.com/@talade_blackie?source=rss-f57a57d6ffe6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*J4S-Yu0JD4PlAsFD7Wt0uA.jpeg</url>
            <title>Stories by Talade on Medium</title>
            <link>https://medium.com/@talade_blackie?source=rss-f57a57d6ffe6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 11:55:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@talade_blackie/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Journey through my Second Semester Final Project]]></title>
            <link>https://medium.com/@talade_blackie/journey-through-my-second-semester-final-project-817e4dee04b1?source=rss-f57a57d6ffe6------2</link>
            <guid isPermaLink="false">https://medium.com/p/817e4dee04b1</guid>
            <category><![CDATA[pagination-in-react]]></category>
            <category><![CDATA[github-api]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Talade]]></dc:creator>
            <pubDate>Tue, 10 Jan 2023 00:12:28 GMT</pubDate>
            <atom:updated>2023-01-10T00:15:00.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Closeup of computer screen showing React code on the left side and output n the right side" src="https://cdn-images-1.medium.com/max/1024/1*rNjsas6YVWVv-jGxgczkIg.jpeg" /></figure><p>I started learning React.js about three months ago, after I had been writing Vanilla JS for about 6 months and was beginning to see the reasons for using frameworks, in terms of efficiency, scalability, and general happiness. (learned after trying to build an e-commerce website with vanilla js).</p><p>I’m currently enrolled at Altschool of Engineering, and as our final project for the second semester, we were to build a complete website from the ground up with React.js, implementing a couple of features and principles we had been taught all semester.</p><p><strong>THE TASK</strong></p><ol><li>Implement an API fetch of your GitHub portfolio showing a page containing all your GitHub repos (implementing pagination for the list).</li><li>Create another page showing details of individual repositories when clicked using nested routes.</li><li>Implement the proper SEO and 404 pages.</li></ol><p>Extra points for good UI and design.</p><p><strong>THE GAMEPLAN</strong></p><ol><li>Design a straightforward but visually appealing UI for the project.</li><li>Create functions to get the data from the GitHub API using fetch, and make them available in the app to be called when needed.</li><li>Call the fetching functions, and store the data in states.</li><li>Dispaly the repos and implement pagination to show a controlled amount of repos on the page at a time.</li><li>Add preloader to display while waiting for the data to load.</li><li>Implement error page and error boundaries.</li><li>Styling.</li></ol><p>Deciding on a UI was a bit of a challenge because I wanted to display quite a bit of information about each repository on the homepage without making the page look cluttered and unappealing.</p><p>I finally decided on a basic design, here&#39;s a wireframe I did in Figma here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujyEb7pQP8-QYL_J4eebvw.png" /><figcaption>The wireframe for my project done in Figma</figcaption></figure><p>Once the UI was decided, I started to actually build the app. I implemented the basic React file structure, separating my utility components, from UI components, files to make the API calls separately, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/166/1*flBQHO9qAmQYUW4kJwC4kw.png" /></figure><p>The next step was to successfully get data from the GitHub API. I implemented this using simple fetch calls to the different endpoints I needed. Here’s an example of one I wrote to get my profile data:</p><pre>export const getProfileData = async () =&gt; {<br>  const response = await fetch(&quot;https://api.github.com/users/taladeogoa&quot;);<br>  const data = await response.json();<br>  return data;<br>};</pre><p>All these getter functions were stored in a separate file I called data.js and exported to be used where needed. I also created components for the homepage, a dynamic page for individual repositories, and an error page.</p><p>The getter functions, getProfileData and getReposData were imported to the homepage, and the individual repos page and called them using the useEffect hook, with the dependency set to an empty array since the function needed to be run only once.</p><p>I then stored the data I got to states using the useState hook.</p><p>Moving on to pagination…</p><p>Pagination is the process of dividing a long page into smaller sections of more readable and accessible content. Implementing this was fairly straightforward, and all we need is to know the number of repos we want per page. The rest is a matter of simple mathematics, some onClick functions and CSS of your preference.</p><pre>  const indexOfLastRepo = currentPage * reposPerPage;<br>  const indexOfFirstRepo = indexOfLastRepo - reposPerPage;<br>  const currentRepos = reposData.slice(indexOfFirstRepo, indexOfLastRepo);<br><br>  const pageNumbers = [];<br><br>  for (let i = 1; i &lt;= Math.ceil(totalRepos / reposPerPage); i++) {<br>    pageNumbers.push(i);<br>  }</pre><p>I wanted to add a preloader to display while the data from the API was being returned, so I created a loading state, used a simple CSS loader, and implemented it with an if block.</p><pre>  if (loading) {<br>    return (<br>      &lt;div className=&quot;loader-container&quot;&gt;<br>        &lt;div className=&quot;loader&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>    );<br>  }</pre><p>Almost done, I needed a fallback page if a user accessed a URL that didn&#39;t exist. I did this by using an asterisk as the last route in my Router element. In that position, it acts as a fallback for any routes not already defined.</p><p>Finally, I styled the pages according to the design I had created in Figma. A fun feature I enjoyed adding was a little circle beside the language name that showed different colours based on what language that repo used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*6TimRfB4y-sEWEJVA3pT_Q.png" /></figure><p>This was a challenging learning experience for me because I juggled completing this with studying for my university finals. However, it came out quite beautifully, and I was quite satisfied with my work at the end of the day. Take a look at my project <a href="https://taladeogo-second-semester-project.netlify.app/home">here</a> or view my source code <a href="https://github.com/TaladeogoA/altschool-second-semester-final-project">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=817e4dee04b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>