<?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>DEV Community: keji</title>
    <description>The latest articles on DEV Community by keji (@balogunkeji).</description>
    <link>https://dev.to/balogunkeji</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%2F269103%2Fd0373582-b037-4658-9bcf-6090d981472b.jpg</url>
      <title>DEV Community: keji</title>
      <link>https://dev.to/balogunkeji</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/balogunkeji"/>
    <language>en</language>
    <item>
      <title>Creating a Flex component using Next.js, Styled-Componets and Typescript</title>
      <dc:creator>keji</dc:creator>
      <pubDate>Tue, 22 Aug 2023 14:55:20 +0000</pubDate>
      <link>https://dev.to/balogunkeji/creating-a-flex-component-using-nextjs-styled-componets-and-typescript-f1g</link>
      <guid>https://dev.to/balogunkeji/creating-a-flex-component-using-nextjs-styled-componets-and-typescript-f1g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When building a web application, creating flexible and reusable UI components is crucial for maintaining a scalable and maintainable codebase. In this article, I will delve into the process of creating a "Flex" component using the powerful trio of Next.js, Styled-Components, and TypeScript. By harnessing the synergy of these tools, you'll gain the capacity to effortlessly construct flexible and dynamic layouts that adapt harmoniously to various devices.&lt;br&gt;
Prerequisites&lt;br&gt;
Before you begin, make sure you have the following installed:&lt;br&gt;
Node.js and npm (Node Package Manager)&lt;br&gt;
Basic understanding of React.js, Next.js, Styled-Components, and TypeScript&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Set Up Your Next.js Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you haven't already set up a Next.js project, follow these steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-next-app my-flex-app
cd my-flex-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;This will create a new Next.js project in a folder called my-flex-app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Install Dependencies&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Inside your project directory, install the required dependencies: styled-components, @types/styled-components, and typescript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install styled-components @types/styled-components typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Create Components Folder&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a folder named components inside the src directory of your Next.js project. This is where you'll store your flexible components.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ausj2rfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43lhmph607jl4bvtb7ya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ausj2rfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43lhmph607jl4bvtb7ya.png" alt="Image description" width="346" height="234"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Step 4: Create a Flexible Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Inside the components folder, create a new file for your flexible component. Let's create a FlexBox.tsx component as an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface StyleProps {

  display?: string
  justifycontent?: string
  alignitems?: string
  width?: string | number
  height?: string | number
  flexWrap?: string
  flexdir?: string
  aligncontent?: string
  maxwidth?: string
  margin?: string
  gap?: string
  flexgrow?: string
  order?: string
}

export const FlexibleDiv = styled('div')&amp;lt;StyleProps&amp;gt;`
  display: flex;
  justify-content: ${({ justifycontent }) =&amp;gt; justifycontent ?? 'center'};
  align-items: ${({ alignitems }) =&amp;gt; alignitems ?? 'center'};
  flex-wrap: ${({ flexWrap }) =&amp;gt; flexWrap ?? 'wrap'};
  flex-direction: ${({ flexdir }) =&amp;gt; flexdir ?? 'row'};
  width: ${({ width }) =&amp;gt; width ?? 'max-content'};
  height: ${({ height }) =&amp;gt; height ?? 'max-content'};
  max-width: ${({ maxwidth }) =&amp;gt; maxwidth ?? '100%'};
  gap: ${({ gap }) =&amp;gt; gap ?? '0'};
  flex-grow: ${({ flexgrow }) =&amp;gt; flexgrow ?? '0'};
  order: ${({ order }) =&amp;gt; order ?? '0'};
`;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Use the Flexible Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now you can use the &lt;strong&gt;FlexbleDiv&lt;/strong&gt; component in your pages or other components. For instance, let's create a HomePage.tsx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// pages/HomePage.tsx

import React from 'react';
import FlexBox from '../components/FlexBox';

const HomePage: React.FC = () =&amp;gt; {
  return (
    &amp;lt;FlexibleDiv flexdir="column" justifycontent="center" alignitems="center"&amp;gt;
      &amp;lt;h1&amp;gt;Hello, Flex Components!&amp;lt;/h1&amp;gt;
      &amp;lt;p&amp;gt;This is a flexible component example.&amp;lt;/p&amp;gt;
    &amp;lt;/FlexibleDiv&amp;gt;
  );
};

export default HomePage;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;: Run Your Next.js Application&lt;/p&gt;

&lt;p&gt;Start your Next.js development server to see the results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run dev

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your flexible &lt;strong&gt;FlexibleDiv&lt;/strong&gt; component can now be used throughout your application. By importing it and passing the desired props, you can easily create flexible layouts and components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we've learned how to create flexible components using Next.js, Styled-Components, and TypeScript. This approach provides a solid foundation for building scalable and maintainable UI components within your web application. By following these steps, you can enhance the reusability and flexibility of your code, making it easier to manage and extend as your project grows.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Algorithm in JavaScript: Finding the Minimum and Maximum Sums</title>
      <dc:creator>keji</dc:creator>
      <pubDate>Wed, 19 Jul 2023 14:05:11 +0000</pubDate>
      <link>https://dev.to/balogunkeji/how-i-solved-the-hackerrank-mini-max-sum-algorithm-in-javascript-finding-the-minimum-and-maximum-sums-3fdh</link>
      <guid>https://dev.to/balogunkeji/how-i-solved-the-hackerrank-mini-max-sum-algorithm-in-javascript-finding-the-minimum-and-maximum-sums-3fdh</guid>
      <description>&lt;p&gt;In this blog post, we'll dive into solving the Mini-Max Sum algorithm challenge from HackerRank using JavaScript. We'll explore the problem statement, discuss the approach to solve it, and provide a step-by-step breakdown of the JavaScript solution.&lt;/p&gt;

&lt;p&gt;Problem Statement:&lt;br&gt;
The Mini-Max Sum algorithm challenge requires finding the minimum and maximum possible sums that can be obtained by summing exactly four out of the five integers in a given array.&lt;/p&gt;

&lt;p&gt;Approach and Solution:&lt;br&gt;
To solve the Mini-Max Sum algorithm challenge, we can follow these steps:&lt;/p&gt;

&lt;p&gt;Sort the input array in ascending order. This allows us to easily identify the smallest and largest elements.&lt;br&gt;
Calculate the minimum sum by adding the first four elements of the sorted array using the reduce function.&lt;br&gt;
Calculate the maximum sum by adding the last four elements of the sorted array using the reduce function.&lt;br&gt;
Output the minimum and maximum sums.&lt;br&gt;
Here's the JavaScript implementation of the solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function miniMaxSum(arr) {
    const sortedArray = arr.sort((a,b) =&amp;gt; a - b);
    const minSum = sortedArray.slice(0, arr.length - 1).reduce((acc, sum) =&amp;gt; acc + sum);
    const maxSum = sortedArray.slice(1).reduce((acc, sum) =&amp;gt; acc + sum);
    console.log(minSum, maxSum);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Usage:&lt;br&gt;
Let's consider an example to demonstrate the solution. Suppose we have an input array [1, 2, 3, 4, 5]. Calling the miniMaxSum function with this array as an argument will provide us with the minimum and maximum sums.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = [1, 2, 3, 4, 5];
miniMaxSum(arr); // Output: 10 14
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the minimum sum is obtained by adding the first four elements [1, 2, 3, 4], resulting in 10. The maximum sum is obtained by adding the last four elements [2, 3, 4, 5], resulting in 14.`&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
In this blog post, we explored the HackerRank Mini-Max Sum algorithm challenge and learned how to find the minimum and maximum sums of an array of integers using JavaScript. We discussed the problem statement, provided a step-by-step breakdown of the approach, and demonstrated an example usage. By understanding the algorithm and implementing the provided solution, you can successfully solve the Mini-Max Sum challenge on HackerRank.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Git Basic Techniques(Cloning).</title>
      <dc:creator>keji</dc:creator>
      <pubDate>Wed, 03 Jun 2020 09:07:58 +0000</pubDate>
      <link>https://dev.to/balogunkeji/git-basic-techniques-cloning-18jc</link>
      <guid>https://dev.to/balogunkeji/git-basic-techniques-cloning-18jc</guid>
      <description>&lt;p&gt;&lt;strong&gt;GIT CLONING&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As a starter, using git techniques can be overwhelming and in this post, I'll talk about one of the basic git techniques which are &lt;strong&gt;Git Clone&lt;/strong&gt;. Join me as I explain what git clone is.&lt;br&gt;
What is Git Clone?&lt;br&gt;
the &lt;strong&gt;clone&lt;/strong&gt; command downloads an existing Git repository/project to your local computer. This enables us to work on our copy of the project/repository without any reference from other changes.&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165005565%2F3Tq1JT58n.gif" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165005565%2F3Tq1JT58n.gif" alt="git-clone.gif"&gt;&lt;/a&gt;&lt;br&gt;
To clone a repository, run the git-clone command, followed by the path to the repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone/path/to/repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if outsource doesn't reside in the same system, you can SSH to a remote system and clone too&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone username@remote_system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here is also a graphical example of cloning with SSH.&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165692679%2FJlhhOmkwo.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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165692679%2FJlhhOmkwo.png" alt="clone2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you're cloning from a source on the internet, you can simply add the URL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone  https://github.com/username.git/the project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165979963%2FTm2U4jwmn.jpeg" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1591165979963%2FTm2U4jwmn.jpeg" alt="DownloadZip2.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in this post, I've talked about &lt;strong&gt;GIT CLONE&lt;/strong&gt; and the ways on how to clone repository or project right into your &lt;br&gt;
local computer.&lt;/p&gt;

&lt;p&gt;Further reading&lt;/p&gt;

&lt;p&gt;you can visit &lt;a href="https://git-scm.com" rel="noopener noreferrer"&gt;GIT&lt;/a&gt; to learn more about Git basic techniques. &lt;/p&gt;

</description>
      <category>git</category>
      <category>codenewbie</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
