<?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 Ojo Abisola on Medium]]></title>
        <description><![CDATA[Stories by Ojo Abisola on Medium]]></description>
        <link>https://medium.com/@ojoabisola387?source=rss-17bcc429e9a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4IFGgbccBEiUHvTP</url>
            <title>Stories by Ojo Abisola on Medium</title>
            <link>https://medium.com/@ojoabisola387?source=rss-17bcc429e9a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:56:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ojoabisola387/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[Frameworks vs Libraries(explained).]]></title>
            <link>https://medium.com/@ojoabisola387/frameworks-and-libraries-b01bf01252ee?source=rss-17bcc429e9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b01bf01252ee</guid>
            <dc:creator><![CDATA[Ojo Abisola]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 23:36:58 GMT</pubDate>
            <atom:updated>2023-02-27T14:41:29.610Z</atom:updated>
            <content:encoded><![CDATA[<p>As a developer, you have one way or the other worked with either a framework or a library, even both as the case may be. But do you really understand the core definitions of these two terms?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*9emc9EvQgpLtgSyr9kux3Q.jpeg" /></figure><p>In this article, we are going to look into these two terms, their similarities and differences.</p><h4>LIBRARY</h4><p>A library is basically a collection of pre-written reusable code that can be used in your program or application. A library is also a collection of related functionality, a developer just needs to simply access the functionality he requires and not necessarily look into the internal details of the library. As a result of this, the developer has more time to focus on the development of their application. Examples of libraries are NumPy, TensorFlow and so on.</p><h4>FRAMEWORK</h4><p>A framework acts as a structure where the developer provides their own code that the framework interacts with. A framework may include support programs, compilers, toolset and APIs all geared up towards the development of a project. We don’t include a framework we simply integrate our code in it. Examples of frameworks are Angular, Django, Ruby on Rails and so much more.</p><p>Now let’s have a look at the illustration below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*TbYwpYGJY-vnZ7QwZ4AN5Q.png" /><figcaption>image gotten from google search</figcaption></figure><p>In the illustration above, the framework calls the code provided by the developer to create a specific type of program, the developer’s code calls the library to create a specific type of program and the framework usually contains one or more libraries to enable the development of a project.</p><p>A real life example to explain these two terms better would be to think of framework as the blueprint a carpenter uses to make chairs and library as the materials he uses varying in sizes, lengths and thickness in making the chairs.</p><h4>SIMILARITIES</h4><ul><li>Both frameworks and libraries provide functionality.</li><li>They both give you the opportunity to reuse existing web app functions.</li><li>They both speed up web application development.</li></ul><h4>DIFFERENCES</h4><p>Many developers use the terms framework and library interchangeably, however, they are not the same. Frameworks contain key distinguishing feature that separate them from libraries.</p><ul><li><strong>Inversion</strong> <strong>of</strong> <strong>control</strong>: In a framework, unlike in libraries, the overall program’s flow of control and data is not dictated by the caller, but the framework itself.</li><li>In Library, there is flexibility while in a framework, a developer is constrained to work within the preset architecture.</li></ul><p>In conclusion, frameworks and libraries are very essential in software development. They speed up development, they result in fewer errors and they help you focus on the essential features of your program.</p><p>I hope this article was helpful. I definitely enjoyed writing it and it expanded my knowledge as a developer.</p><p>Here are some of the resources I used:</p><ul><li><a href="https://en.m.wikipedia.org/wiki/Software_framework">https://en.m.wikipedia.org/wiki/Software_framework</a></li><li><a href="https://stackoverflow.com/questions/4099975/difference-between-a-module-library-and-a-framework">https://stackoverflow.com/questions/4099975/difference-between-a-module-library-and-a-framework</a></li><li><a href="https://www.c-sharpcorner.com/uploadfile/a85b23/framework-vs-library/">https://www.c-sharpcorner.com/uploadfile/a85b23/framework-vs-library/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b01bf01252ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an app that fetches my GitHub Repositories using React and GitHub API]]></title>
            <link>https://medium.com/@ojoabisola387/i-built-an-app-that-fetches-my-github-repositories-using-react-and-github-api-3dd2d109e1fd?source=rss-17bcc429e9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dd2d109e1fd</guid>
            <category><![CDATA[github-api-repository]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ojo Abisola]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 10:39:02 GMT</pubDate>
            <atom:updated>2023-07-11T22:22:47.180Z</atom:updated>
            <content:encoded><![CDATA[<p>Transitioning from just basic Html, CSS and Javascript to a Javascript-based UI development library called React is one of the best things that has happened to me. And as an AltSchool Africa student, I got the best experience during this transition.</p><p>I was given an examination project for my second-semester examination which is this👇👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*NLDSMpzCQ-CHcQw2uDBaEw.png" /><figcaption>Exam project</figcaption></figure><p>In this article, I will be taking you through how I was able to implement all that I was asked in a project which I named “Github repo pagination&quot;. I used an online code editor ‘replit’ to write my codes and it was effective to use.</p><p>For this project, I created three folders namely Pages, components, and Images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*r79cq8pb9JhozvqAYkFr7Q.png" /><figcaption>The folders and files I created for my project</figcaption></figure><p>The component folder contains a file for error boundary implementation, a file for API fetch as well as pagination and a file for the general content that will be displayed on every page. The Images folder contains all the images and icon used in the project. The Pages folder contains a file for each page I want to render. Other files like App.css, index.jsx, package.json, came with the React javascript template on replit.</p><ul><li>The first thing I did was install the react router library for routing.</li></ul><pre>npm install -save react-router-dom <br></pre><p>After this installation was complete, I went ahead to import all the React Router components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*Mc9hhbOjYSpmsnBjqXqp5Q.png" /></figure><p>I imported them into components that I implemented its use.</p><p>In the Home file, ErrorPage file, Respositories file, I implemented NavLinks for smooth navigation within the website. Here is the code:</p><pre> &lt;NavLink  style= {({isActive}) =&gt; isActive ? {color:&#39;blue&#39;} : {color: &#39;black&#39;}}to=&quot;/&quot; className=&quot;nav&quot;&gt;Home&lt;/NavLink&gt;<br>  <br>    <br> <br>    &lt;NavLink style= {({isActive}) =&gt; isActive ? {color:&#39;blue&#39;} : {color: &#39;black&#39;}} to=&quot;repos&quot; className= &quot;nav&quot;&gt; Repositories &lt;/NavLink&gt;<br><br>     <br>          &lt;NavLink to=&quot;error&quot; className= &quot;nav&quot;&gt;ErrorPage&lt;/NavLink&gt;</pre><p>I declared functions for the home page, repositories page, and error page which contains all the information to be displayed on each page. Here is the code for each of them.</p><pre>//In the home file<br>export default function Home(){<br>  return(<br>  &lt;main&gt;<br>  &lt;div className = &#39;nav--link&#39; &gt;<br><br>    &lt;NavLink  style= {({isActive}) =&gt; isActive ? {color:&#39;blue&#39;} : {color: &#39;black&#39;}}to=&quot;/&quot; className=&quot;nav&quot;&gt;Home&lt;/NavLink&gt;<br>  <br>    <br> <br>    &lt;NavLink style= {({isActive}) =&gt; isActive ? {color:&#39;blue&#39;} : {color: &#39;black&#39;}} to=&quot;repos&quot; className= &quot;nav&quot;&gt; Repositories &lt;/NavLink&gt;<br><br>     <br>          &lt;NavLink to=&quot;error&quot; className= &quot;nav&quot;&gt;ErrorPage &lt;/NavLink&gt;<br>    &lt;/div&gt;<br>    <br>    &lt;div className=&quot;home--intro&quot;&gt;<br>      &lt;img src={picture} className=&quot;home--pic&quot;/&gt;<br>      &lt;h1 className=&quot;home--name&quot;&gt;Abisola Ojo&lt;/h1&gt;<br>      &lt;p className=&quot;home--note&quot;&gt;Frontend developer&lt;/p&gt;<br>      <br>      &lt;div className=&quot;logo--links&quot;&gt;<br>      &lt;div&gt;&lt;a href=&quot;https://twitter.com/b_ojo_&quot;&gt;&lt;img src={picture1} alt=&quot;twitter-logo&quot; className=&quot;logo--link&quot;/&gt;&lt;/a&gt;&lt;/div&gt;<br>      &lt;div&gt;&lt;a href=&quot;https://www.linkedin.com/in/abisola-ojo-/&quot;&gt;&lt;img src={picture2} alt=&quot;linkedin-logo&quot; className=&quot;logo--link&quot;/&gt;&lt;/a&gt;&lt;/div&gt;<br>      &lt;div&gt;&lt;a href=&quot;https://www.reddit.com/user/bojodiva1&quot;&gt;&lt;img src={picture3} alt=&quot;reddit-logo&quot; className=&quot;logo--link&quot;/&gt;&lt;/a&gt;&lt;/div&gt;<br> &lt;/div&gt;<br>      <br>      &lt;p className=&quot;home--note&quot;&gt; Hello there! welcome to my AltSchool Africa Exam project&lt;/p&gt;<br>    &lt;/div&gt;<br>   <br>  &lt;/main&gt;<br>  )<br>}<br><br><br>//In the Repositories file<br> export default function Repositories(){<br>   return(<br>  &lt;main&gt;<br>  &lt;div className = &#39;nav--link&#39; &gt;<br><br>    &lt;NavLink  style= {({isActive}) =&gt; isActive ? {color:&#39;black&#39;} : {color: &#39;blue&#39;}}to=&quot;/&quot; className=&quot;nav&quot;&gt;Home&lt;/NavLink&gt;<br>  <br>    <br>  <br>    &lt;NavLink style= {({isActive}) =&gt; isActive ? {color:&#39;black&#39;} : {color: &#39;blue&#39;}} to=&quot;repos&quot; className= &quot;nav&quot;&gt; Repositories &lt;/NavLink&gt;<br><br>    &lt;/div&gt;<br><br>    &lt;h1 className=&quot;repo--heading&quot;&gt;My Repos&lt;/h1&gt;<br>    &lt;br&gt;&lt;/br&gt;<br>  &lt;MyRepos/&gt;<br>  &lt;/main&gt;<br> )}  <br><br><br>//In the ErrorPage file<br>export default function ErrorPage() {<br>  rern(<br>    &lt;main&gt;<br>      &lt;div className=&quot;nav--link&quot;&gt;<br>&lt;button className=&quot;nav--link-button&quot;&gt;<br>    &lt;NavLink  style= {({isActive}) =&gt; isActive ? {color:&#39;red&#39;} : {color: &#39;black&#39;}}to=&quot;/&quot; className=&quot;nav&quot;&gt;Home&lt;/NavLink&gt;<br>   &lt;/button&gt;<br><br>       &lt;button className=&quot;nav--link-button&quot;&gt;<br>          &lt;NavLink to=&quot;error&quot; className= &quot;nav&quot;&gt;ErrorPage &lt;/NavLink&gt;<br>    &lt;/button&gt;<br>      &lt;/div&gt;<br>      &lt;p&gt;hello&lt;/p&gt;<br>    &lt;/main&gt;<br>  )<br>}</pre><p>I will explain what I did in the error page code above later in this article. I also implemented routes to render paths and link all the component within the website. I implemented this in the GeneralPage.jsx component.</p><pre>    &lt;Routes &gt;<br>           &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>           &lt;Route path=&quot;repos&quot; element={&lt;Repositories /&gt;} /&gt;<br>            &lt;Route path=&quot;error&quot; element={&lt;ErrorPage/&gt;} /&gt;<br>           &lt;Route path=&quot;*&quot; element= { &lt;h1 className=&quot;error&quot;&gt;Not Found&lt;/h1&gt;}/&gt;<br>          &lt;/Routes&gt;</pre><p>I also implemented 404 page into my routes. A 404 page is a page rendered when a server could not find a requested webpage.</p><pre>&lt;Route path=&quot;*&quot; element={&lt;h1 className=&quot;error&quot;&gt;Not Found&lt;/h1&gt; /&gt;<br></pre><p>When a path not recognized by the server is initiated, a 404 page(“not found&quot;) page is rendered. When you click on the repositories link twice it will render a 404 page .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*9kKSAjVZhmE1GHh3UuLuxA.png" /></figure><ul><li>On the <em>home</em> <em>page</em>, a picture, some icons, and an introductory note is displayed.</li></ul><p>Imported all the image and icons needed for implementation as shown in the code below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*gYuSNQVXXlQhvXKvz1-iyQ.png" /></figure><p>I styled the page with appropriate UI for attractive appearance. I used linear gradient as the background image.</p><pre>.home--pic{<br>  width: 100px;<br>  border-radius: 500px;<br>/*   vertical-align: center; */<br>  justify-content: center;<br>}<br><br>.home--intro{<br> text-align: center;<br>  margin-top: 150px;<br> vertical-align: center;<br> background-image: url(https://medium.com/&quot;https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fgradient%2F&amp;psig=AOvVaw2DbFQd2brYHgdYIz9XFbTN&amp;ust=1667170683110000&amp;source=images&amp;cd=vfe&amp;ved=0CAwQjRxqFwoTCJiZoIevh_sCFQAAAAAdAAAAABAE&quot;);<br>}<br><br>.home--name{<br>  font-size: 38px;<br>  font-family: &#39;Qwitcher Grypen&#39;, cursive;<br>  font-weight: 100;<br>}<br><br>.home--note{<br> font-size: 18px;<br>font-family: &#39;Montserrat&#39;, sans-serif;<br>  font-weight: 40;<br>}<br><br>.logo--links{<br>  display: flex;<br>  align-items: center;<br>  justify-content:center;<br>  text-decoration: none;<br>}<br><br>.logo--link{<br>  width: 35px;<br>  border-radius: 15px;<br>  margin: 10px;<br>  padding: 10px;<br>}<br>.logo--link:hover{<br>  padding: 9px;<br>  background-color:#38898f;<br>}<br><br></pre><ul><li>On the <em>repositories</em> <em>page</em>, my github repositories are displayed.</li></ul><p>Imported MyRepos component from the components folder in the Repositories component is as shown in the code below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*q3s1w0OSH7IkbO_bFVKh7w.png" /></figure><p>Rendered the MyRepos component in the Repositories component as shown in the code below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*TLoaodrbOfOReCXxamW9_g.png" /></figure><p>In MyRepos component, I implemented an API fetch of my Github repositories and I also implemented pagination for the repo list.</p><p>I used React{Component} for implementation. Then imported the Component from react.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*YhahQrvmwv_59qC07zvc0w.png" /></figure><p>Declared states, this holds the initial state of these components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*OfgVHAlvqcXuPdlD2i0BCg.png" /></figure><p>In the above code, “repos&quot; holds the data that will get from the API. “ loading” holds the loading state, it is true when the loader spinner appears and false when the page is rendered successfully. “currentPage&quot; holds the value of the page a user is currently on. “postsPerPage&quot; holds the number of posts that will be displayed per page.</p><p>To fetch the data, the component has to be mounted and this is done with the constructor “componentDidMount( )&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*3qqBWXU7lyYIOaM2fte9bw.png" /></figure><p>In the code above, data is gotten from the github jsonplaceholder API using fetch API.</p><p>After the data has been fetched from the API, it is stored in the repos state using setState( ) method. The loading state is then set to true.</p><p>To display the data gotten from the API, I had to get the “currentPosts&quot; that is the posts to be displayed on a certain page. This was added to the render( ) method section of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*lGwwbKEayNJXh0BPH-3Ihw.png" /></figure><p>In the code above, I got the “indexOfLastPost&quot; which is the last post on a certain page. I also got the “indexOfFirstPost&quot; which is the first post on a certain page. Then I used <strong>slice</strong>( ) array method which sets the posts to be displayed on a certain page.</p><p>After getting the array of <strong>currentPosts</strong>, I had to render a loading state and map through currentPosts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*Td2a3b-8bohdS8nk3KXNxQ.png" /></figure><p>In the above code, if the loading state is true a loading animated spinner will be rendered on the page indicating that the data is being fetched. When the posts is rendering the loading state becomes false. The posts is rendered successfully after it has looked into all the element declared.</p><p>For easy navigation within Posts pages I had to implement pagination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*Zs4ARGSVeyWpYlaOiXFvuA.png" /></figure><p>In the code,I declared a constant, PageNos, which is an array that will be used to hold the page numbers. The totalPosts is the total number of repos and postsPerPage is the number of post on each page. A “for loop&quot; is then used to loop through the quotient of the calculation (totalPosts / postsPerPage). Then the values obtained are then pushed into the pageNos array.</p><p>I also declared a function setPage which takes <strong>pageNo</strong> as an argument and is used to update the currentPage state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Q_KmOZ-4d8oiK7Sjm8tSyg.png" /></figure><p>Now to display the page numbers from the <strong>PageNos</strong> array, I used the map function to map through the pageNos array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*ezVPv368HkEs-JHJmCMjWA.png" /></figure><p>I also created a previous button and a next button. I declared functions to implement an increment for the next button and a decrement for the previous button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*L7W2GztaP_91DgDEUXMfvA.png" /></figure><p>In the above code, I used the <strong>setState</strong>( ) method which updates the <strong>currentPage</strong> state and the page content is updated .</p><p>I then called the functions on each button using the <strong>onClick</strong> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*pnhkRAIOdBIKK5pIjCJE5Q.png" /></figure><p>This is the complete code for <em>MyRepos component</em>:</p><pre>import React, {Component} from &quot;react&quot;;<br><br><br>class MyRepos extends Component {<br><br>  <br>  <br>  constructor(props){<br>    super(props)<br>    this.state = {<br>      repos: [],<br>      loading: false,<br>      currentPage: 1,<br>      postsPerPage: 2,<br>    }<br>  }<br><br>  componentDidMount(){<br><br>  fetch(&quot;https://api.github.com/users/bojodiva/repos&quot;)<br>  .then((response) =&gt; response.json())<br>  .then(data =&gt; {<br>    this.setState({<br>      repos: data,<br>      loading: true,<br>    })<br>  })<br>  }<br><br>//functions handling page increment anf decrement<br>handleIncrement= () =&gt;{<br>   this.setState({<br>currentPage:  this.state.currentPage + 1 });<br>}<br><br>handleDecrement = () =&gt;{<br>  this.setState({<br>    currentPage: this.state.currentPage - 1 }) ;<br>  }<br>render(){<br><br>  var{loading} = this.state<br><br>    const indexOfLastPost = this.state.currentPage * this.state.postsPerPage;<br>    const indexOfFirstPost = indexOfLastPost - this.state.postsPerPage;<br>    const currentPosts = this.state.repos.slice(indexOfFirstPost, indexOfLastPost);<br><br><br>    const pageNos = [];<br><br>    let totalPosts = this.state.repos.length<br>      for ( let i = 1; i &lt;= Math.ceil(totalPosts/ this.state.postsPerPage); i++) {<br>         pageNos.push(i) ;                          <br>      }<br><br>    const setPage = (pageNo) =&gt; {<br>      this.setState({currentPage: pageNo})<br>    }<br><br><br>    if(!loading){<br>      return(<br> &lt;div class=&quot;loader-body&quot;&gt;<br>        &lt;div class=&quot;loader&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>      )<br>    }<br>    else{<br>      return(<br>        &lt;div&gt;<br>          {currentPosts.map(repo =&gt; (<br>           &lt;div className=&quot;container&quot; key={repo.id}&gt;<br>             &lt;a className=&quot;url&quot; href={repo.html_url}&gt;{repo.full_name}&lt;/a&gt;<br>             &lt;p className=&#39;description&#39;&gt;{repo.description} &lt;/p&gt; <br>            &lt;p className=&#39;time&#39;&gt;Time created: {repo.created_at}&lt;/p&gt;<br>                                                            <br>            &lt;br&gt;&lt;/br&gt;<br>            <br>             &lt;p className=&#39;visibility&#39;&gt;{repo.visibility}&lt;/p&gt;<br>           <br>             &lt;br&gt;&lt;/br&gt;<br>            &lt;/div&gt;<br>      ))};<br><br>          <br>          &lt;div className= &quot;page--link&quot;&gt;<br>      &lt;div  className=&quot;number&quot; onClick={this.handleDecrement}&gt;Prev&lt;/div&gt;<br>            <br>           {pageNos.map((pageNo, index) =&gt; (  &lt;div   key={index} className=&quot;number&quot; onClick={() =&gt; {setPage(pageNo)}}&gt;<br>                {pageNo}<br>       &lt;/div&gt;    <br>          ))}<br><br>            <br>     &lt;div  className=&quot;number&quot; onClick={this.handleIncrement}&gt; Next&lt;/div&gt;<br>                                      <br>         <br>        &lt;/div&gt;<br><br>       &lt;/div&gt;   <br>)<br>}<br>}</pre><ul><li>On the <em>Error Page</em>, an error note which says “Oops something went wrong, try reloading the page or go back to another page” is displayed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*6h8wzDs9TS3uerwPqmfIeg.png" /></figure><p>This was achieved using an error boundary. An error boundary is a react component that catches errors in their children component and displays a fallback UI instead of the component that crashed.</p><pre>import React, { Component } from &quot;react&quot;<br><br>class ErrorBoundary extends Component{<br>  state = { hasError: false };<br>  <br>  <br>  componentDidCatch(error, errorInfo){<br>  console.log({error, errorInfo})<br>  }<br><br>  <br>  static getDerivedStateFromError(error){<br>    return{<br>      hasError :true<br>    };<br>  }<br>  render(){<br>    if(this.state.hasError){<br>      return (<br>      &lt;div className=&quot;note&quot;&gt;<br>        &lt;h1 className=&quot;notes&quot;&gt;Oops! something went wrong&lt;/h1&gt;<br>        &lt;p className=&quot;notes&quot;&gt;Try refreshing the page &lt;/p&gt;<br>        &lt;p className=&quot;notes&quot;&gt;Or go back to another page&lt;/p&gt;<br>        &lt;/div&gt;)<br>    }<br>    return this.props.children <br>  }<br>  }<br><br>export default ErrorBoundary;</pre><p>In the above code, state is declared and the state variable(<strong>hasError</strong>) is set to false . “<strong>componentDidCatch</strong>” is a lifecycle method used for triggering side-effects. “<strong>static getDerivedStateFromError</strong>&quot; is also a lifecycle method that allows the Error boundary update state, it accepts an argument and set the state variable<strong>(hasError</strong>) to true if it catches error. The error note is displayed if <strong>this.state.hasError</strong> is true and if false the supposed component to be rendered will be rendered.</p><p>After this, I wrapped the <em>Generalpage component in </em>my App.jsx component with &lt;ErrorBoundary&gt;&lt;/ErrorBoundary&gt;, this will catch any error in the component.</p><pre>import GeneralPage from &quot;./components/GeneralPage&quot;;<br>import ErrorBoundary from &quot;./components/ErrorBoundary&quot;;<br><br><br><br>export default function App() {<br><br>  return (<br>    &lt;main&gt;<br>      &lt;ErrorBoundary&gt;<br>     &lt;GeneralPage /&gt;<br>      &lt;/ErrorBoundary&gt;<br>    &lt;/main&gt;<br>  )<br>}</pre><p>So to implement the ErrorBoundary I purposely made a mistake in my <em>ErrorPage component</em>. I pasted the code earlier. I simply wrongly spelt return which is suppose to render a “hello&quot; message on the page. here is the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*LSMrn1u_o-vNrPk1GG-NJA.png" /></figure><p>Here is the detailed css styling for the entire project:</p><pre>@import url(https://medium.com/&#39;https://fonts.googleapis.com/css2?family=Abel&amp;family=Amaranth&amp;family=Montserrat&amp;family=Qwitcher+Grypen:wght@700&amp;family=Satisfy&amp;family=Tiro+Kannada:ital@1&amp;display=swap&#39;);<br><br><br>*{<br>  margin: 0;<br>  padding: 0;<br>}<br><br><br>body{<br>  background-image: linear-gradient(to left, #c8acb1, #20656a);<br>}<br><br>body::-webkit-scrollbar {<br>    width: 1em;<br>    border-radius: 10px;<br>  }<br>   <br>  body::-webkit-scrollbar-track {<br>   box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;<br>  }<br>   <br>  body::-webkit-scrollbar-thumb {<br>     background-image: linear-gradient(to top, #38898f,  #c9abb2);<br>/*     background-color: #62a2a7; */<br>    outline: 1px solid  #c8acb;<br>  }<br><br>/* my logo style */ <br>.name-logo {<br>    display: grid;<br>    grid-template-columns: repeat(7, 1fr);<br>    text-align: center;<br>    width: 20px; <br>    margin: 15px;<br>}<br><br><br>.button {<br>    border-radius: 10px;<br>    height: 20px;<br>    font-size: 16px;<br>    font-weight: bold;<br>    font-family: &#39;Amaranth&#39;, sans-serif;<br>    margin-left: 1px;<br>  padding: 3px;<br> box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;<br>}<br><br>#o {<br>    background-color: red;<br>    color: black;<br>}<br><br>#a2 {<br>    background-color: orange;<br>    color: black;<br>}<br><br>#l {<br>    background-color: yellow;<br>    color: black;<br>}<br><br>#s {<br>    background-color: green;<br>    color: black;<br>}<br><br>#a {<br>    background-color: blue;<br>    color: black;<br>}<br><br>#i {<br>    background-color: indigo;<br>    color: black;<br>}<br><br>#b {<br>    background-color: violet;<br>    color: black;<br>}<br><br><br><br>/* nav bar styling */<br>.nav--bar{<br>  background-color: var(--background-color);<br>  <br>  box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset;<br>  display: flex;<br>  justify-content:space-between;<br>  flex-shrink: 1;<br>  flex-grow: 1;<br>  flex-basis: 100%;<br>  height: 50px;<br>  background-image: linear-gradient( to right, #181853);<br>}<br><br>.nav--link{<br>  display: flex;<br>  justify-content: space-between;<br>  margin: 10px;<br><br>}<br><br><br><br><br>.nav{<br>  text-decoration: none;<br>  color: white;<br>  font-size:16px;<br>  font-family: &#39;Montserrat&#39;, sans-serif;<br>   padding: 10px;<br>background-image: linear-gradient(to left, #20656a,  #d7c1c5);<br> border-radius: 5px;<br> box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;<br>}<br>.nav:hover{<br>  background-color: #ca7785;<br>  background-image: linear-gradient(to left, #38898f,  #e7d9dc)<br>}<br><br>/* home page styling */<br>.home--pic{<br>  width: 100px;<br>  border-radius: 500px;<br>/*   vertical-align: center; */<br>  justify-content: center;<br>}<br><br>.home--intro{<br> text-align: center;<br>  margin-top: 150px;<br> vertical-align: center;<br> background-image: url(https://medium.com/&quot;https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fgradient%2F&amp;psig=AOvVaw2DbFQd2brYHgdYIz9XFbTN&amp;ust=1667170683110000&amp;source=images&amp;cd=vfe&amp;ved=0CAwQjRxqFwoTCJiZoIevh_sCFQAAAAAdAAAAABAE&quot;);<br>}<br>.home--name{<br>  font-size: 38px;<br>  font-family: &#39;Qwitcher Grypen&#39;, cursive;<br>  font-weight: 100;<br>}<br><br>.home--note{<br> font-size: 18px;<br>font-family: &#39;Montserrat&#39;, sans-serif;<br>  font-weight: 40;<br>}<br><br>.logo--links{<br>  display: flex;<br>  align-items: center;<br>  justify-content:center;<br>  text-decoration: none;<br>}<br><br>.logo--link{<br>  width: 35px;<br>  border-radius: 15px;<br>  margin: 10px;<br>  padding: 10px;<br>}<br>.logo--link:hover{<br>  padding: 9px;<br>  background-color:#38898f;<br>}<br>/* errorpage styling*/<br>.note{<br>  color: blue;<br>  text-align: center;<br>  vertical-align:center;<br>  justify-content: center;<br>  margin: 100px;<br>}<br>.notes{<br>   color: blue;<br>  text-align: center;<br>  vertical-align:center;<br>  justify-content: center;<br>}<br>.error{<br>  color: #004545;<br>text-align: center;<br>  vertical-align:center;<br>  justify-content:center;<br>  margin:100px;<br>  font-size: 25px;<br>  }<br><br>/* repositories styling */<br>.repo--heading{<br>  font-family: &#39;Tiro Kannada&#39;, serif; <br>  text-align: center;<br> vertical-align: center;<br>  margin: 10px;<br>  font-size: 30px;<br>  color: #333;<br>}<br><br>.container{<br>  margin: 50px;<br>   font-family: &#39;Montserrat&#39;, sans-serif;<br>  border: 2px solid  #20656a;<br>  border-radius: 10px;<br>  padding: 30px;<br>}<br><br>.image{<br>  border-radius: 50px;<br>}<br><br><br>  .page--link{<br>    display:flex;<br>    justify-content: center;<br>    align-items: center;<br>    margin-bottom: 60px;<br>  }<br><br>.number{<br>  padding: 10px;<br>   text-align: center;<br>  width: 3%;<br>  color: white;<br>  font-size: 8px;<br>   box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;<br>  cursor: pointer;<br><br>  background-color: #20656a;<br>  border-radius: 10px;<br>  margin: 1px;<br>}<br>.number:hover {<br>  padding: 9px;<br>  background-color:#c8acb1;<br>}<br><br>span{<br> padding:20px;<br>}<br><br>  .num{<br>    justify-content: center;<br>    line-height: 20vh;<br>    vertical-align: center;<br>  }<br><br>.url{<br>  font-size: 25px;<br>  text-decoration: none;<br>  color: black;<br>  font-weight: bolder;<br>  margin-bottom: 5px;<br>  margin: 10px;<br>  overflow: wrap;<br>}<br><br>.constant{<br>  font-size: 22px;<br>  text-decoration: none;<br>  color:#3c3434;<br>   margin: 15px;<br>  text-decoration: underline;<br>}<br><br>.part{<br>  margin: 15px;<br>  color: #212121;<br>  font-size: 15px<br>}<br><br>.repo--link{<br>  text-decoration: none;<br>}<br><br>.description{<br>  margin-bottom: 5px;<br>  margin:10px;<br>}<br><br>.time{<br>  margin: 10px;<br>}<br><br>.visibility{<br>  font-weight: bold;<br>  margin: 10px;<br>  <br>}<br><br> .loader-body {<br>        width: 100%;<br>        height: 100%;<br>        position: fixed;<br>        top: 0;<br>        left: 0;<br>        background-color: #a1ced1;<br>        display: grid;<br>        place-items: center;<br>      }<br><br>      .loader {<br>        border: 5px solid #3c2a2a;<br>        border-top: 5px solid #136478;<br>        border-radius: 40%;<br>        width: 70px;<br>        height: 70px;<br>        animation: spin 1s linear infinite;<br>      }<br><br>      @keyframes spin {<br>        0% {<br>          transform: rotate(0deg);<br>        }<br><br>        100% {<br>        transform: rotate(360deg);<br>        }<br>  }</pre><p>Lastly I implemented proper SEO, SEO means “search engine optimization&quot;, it is used to increase the visibility of a website in the search result of major search engines.</p><p>In react, SEO can be implemented through the use of React Helmet. In this project I will used two components from React Helmet namely <strong>Helmet</strong> and <strong>HelmetProvider</strong>.</p><p>The <strong>HelmetProvider</strong> is wrapped around the entire app component to create context. The <strong>Helmet</strong> is used to implement <em>meta</em> tags.</p><p>But first, let’s install the React helmet component library</p><pre>npm install react-helmet-async<br></pre><p>After this was complete, I imported Helmet in my landing page which is the <em>homepage</em>. I included the meta tags and a title into its component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*iB9rwJTDpMujFaPnJCWAcQ.png" /></figure><p>Also, I Imported <strong>HelmetProvider</strong> into the <em>App.jsx component</em>. Wrapped all the entire component “GeneralPage” with the <strong>&lt;HelmetProvider&gt;</strong> wrapper.</p><p>Declared a constant helmetContext and passed it as a prop into the HelmetProvider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*l1bahrD2uWAVXclq7eECgg.png" /></figure><p>And that is all, I have successfully implemented all I have been asked to do in my project. I enjoyed working on this project and it gave me a detailed understanding of all the implementations. I hope you enjoyed reading and found it helpful.</p><p>Here is summary of all I implemented:</p><ul><li>Implemented React router for smooth and easy navigation within the website.</li><li>Implemented 404 page to display a “not found” note on the page when a path is not recognized by the server.</li><li>Implemented a fetch API of my Github repositories.</li><li>Implemented pagination to navigate users within webpages.</li><li>Implemented an Error Boundary</li><li>Implemented an Error page to test the Error Boundary.</li><li>Implemented SEO for page traffic and visibility on major search engine</li><li>And finally implemented good UI and designs.</li></ul><p>Here is the link to the deployed site for the project: <a href="https://endearing-cupcake-266e60.netlify.app/">https://endearing-cupcake-266e60.netlify.app/</a></p><p>Here is a list of resources that helped my research:</p><ul><li><a href="https://youtu.be/bMknfKXIFA8">https://youtu.be/bMknfKXIFA8</a></li><li><a href="https://developer.mozilla.org/">https://developer.mozilla.org/</a></li><li><a href="https://stackoverflow.com/">https://stackoverflow.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dd2d109e1fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>