<?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: Samuel Peters</title>
    <description>The latest articles on DEV Community by Samuel Peters (@bieefilled).</description>
    <link>https://dev.to/bieefilled</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%2F948435%2F44bba788-ffb8-47d8-af3e-e78f8b127a35.jpg</url>
      <title>DEV Community: Samuel Peters</title>
      <link>https://dev.to/bieefilled</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bieefilled"/>
    <language>en</language>
    <item>
      <title>Building a Simple JQuery Carousel</title>
      <dc:creator>Samuel Peters</dc:creator>
      <pubDate>Sat, 28 Oct 2023 12:06:13 +0000</pubDate>
      <link>https://dev.to/bieefilled/building-a-simple-jquery-carousel-1db7</link>
      <guid>https://dev.to/bieefilled/building-a-simple-jquery-carousel-1db7</guid>
      <description>&lt;p&gt;Carousels also known as sliders or slideshows, are a popular way to display multiple images or content in a compact and visually appealing manner on a blog post. In this article, I'll guide you through the process of creating a simple carousel for your website, enhancing the user experience and engagement with your content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Before we begin, ensure you have the following resources ready:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;A basic understanding of HTML, CSS, and JavaScript.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;A set of images you want to feature in your carousel.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;A text editor for code editing.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. HTML Structure:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start by setting up the HTML structure for your carousel. Create a new HTML file and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, 
initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Blog Post Carousel&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"carousel-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"carousel"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"carousel-slide"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"image1.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Image 1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"carousel-slide"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"image2.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Image 2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"carousel-slide"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"image3.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Image 3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://code.jquery.com/jquery-3.6.0.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- jQuery Library --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Include jQuery CDN (Content Delivery Network)&lt;/em&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;script src="https://code.jquery.com/jquery-3.6.0.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In code Above, we have the basic HTML structure with a container for the carousel and three slides, each containing an image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. CSS Styles (style.css):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, add some CSS styles to make your carousel look visually appealing. Create a new CSS file (style.css) and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Add basic styling for the carousel */&lt;/span&gt;
&lt;span class="nc"&gt;.carousel-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.carousel&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.carousel-slide&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These styles ensures that the images are responsive and visual appealing&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. JavaScript Functionality (script.js):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To enable navigation within the carousel, you'll need some JavaScript. Create a new JavaScript file (script.js) and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;$carousel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.carousel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;$slides&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.carousel-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;currentIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;showSlide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;currentIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$slides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;$slides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;currentIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nx"&gt;$carousel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;css&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;transform&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`translateX(-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;currentIndex&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;%)`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$nextButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;$prevButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;$nextButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;showSlide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;

        &lt;span class="nx"&gt;$prevButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;showSlide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;autoAdvanceInterval&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Change slide every 3 seconds&lt;/span&gt;

    &lt;span class="nx"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;showSlide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;autoAdvanceInterval&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Outcome&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Bieefilled/embed/PoVZKdP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  More
&lt;/h2&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Bieefilled/embed/RwvWjvv?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
 Carousels are an excellent way to showcase images or content in an engaging and organized manner. Feel free to customize the images, styles, and functionality to match your blog's design and requirements. By following these steps, you can enhance your blog's visual appeal and provide a better user experience for your readers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you found the information valuable, please consider giving it a thumbs up by hitting the "Like" button and sharing it with your network.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>jquery</category>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Basic and Applied Research: A Friendly Guild</title>
      <dc:creator>Samuel Peters</dc:creator>
      <pubDate>Wed, 25 Oct 2023 22:23:38 +0000</pubDate>
      <link>https://dev.to/bieefilled/basic-and-applied-research-a-friendly-guild-484l</link>
      <guid>https://dev.to/bieefilled/basic-and-applied-research-a-friendly-guild-484l</guid>
      <description>&lt;p&gt;Have you ever wondered how the world around us works? Or how we can solve some of the biggest challenges facing humanity today? The answers to these questions lie in the world of &lt;strong&gt;research&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Research is the process of asking questions and obtaining answers. It's how we learn new things and solve problems. Research can be divided into two main types: basic and applied. In this article,  I will explain what these types of research are, why they are important, and how they work together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Research:&lt;/strong&gt; Driven by curiosity and the desire to understand the world around us, it's not about solving any particular problem but rather about expanding our knowledge of a specific topic. For example, basic research can help us comprehend how the human brain works, how the universe began, and how climate change affects the environment.&lt;/p&gt;

&lt;p&gt;Basic research deals with "&lt;strong&gt;why&lt;/strong&gt;" questions, as it seeks to understand the underlying reasons and causes behind an event. For example, why does the human brain function the way it does? Why did the universe originate with a big bang? Why does climate change occur?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Applied research&lt;/strong&gt;: Focuses on solving real-world problems and utilizes key research findings to develop new products, services, or processes. For instance, applied research can aid in the development of new therapies, renewable energy products, or educational programs to enhance student learning.&lt;/p&gt;

&lt;p&gt;Applied research deals with "&lt;strong&gt;what&lt;/strong&gt;" questions because it aims to find solutions and applications to a problem. For example, what can we do to cure diseases? What can we do with clean energy? What can we teach students to enhance their learning?&lt;/p&gt;

&lt;p&gt;Both basic and applied research are essential for improvement. Together, they help us comprehend the world around us and address the challenges we face.&lt;/p&gt;

&lt;p&gt;Here are some characteristics of basic and applied research:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Characteristic&lt;/th&gt;
&lt;th&gt;Basic research&lt;/th&gt;
&lt;th&gt;Applied research&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Purpose&lt;/td&gt;
&lt;td&gt;To advance knowledge&lt;/td&gt;
&lt;td&gt;To solve a specific problem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Focus&lt;/td&gt;
&lt;td&gt;Theoretical&lt;/td&gt;
&lt;td&gt;Practical&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Timeframe&lt;/td&gt;
&lt;td&gt;Long-term&lt;/td&gt;
&lt;td&gt;Short-term&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Funding&lt;/td&gt;
&lt;td&gt;Typically comes from government or private foundations&lt;/td&gt;
&lt;td&gt;Typically comes from businesses, government agencies, or non-profit organizations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Examples&lt;/td&gt;
&lt;td&gt;Developing new theories about how the mind works&lt;/td&gt;
&lt;td&gt;Developing new drugs to treat diseases&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Enjoyed this content? Don't forget to give it a thumbs up 👍 and share it with your friends if you found it valuable. Your support helps us reach more people and continue sharing great content!"&lt;/p&gt;

</description>
      <category>research</category>
      <category>computerscience</category>
      <category>softwaredevelopment</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What Happened When I Decided to Contribute to One Open Source Project Every Day for a Month</title>
      <dc:creator>Samuel Peters</dc:creator>
      <pubDate>Thu, 19 Oct 2023 01:44:00 +0000</pubDate>
      <link>https://dev.to/bieefilled/what-happened-when-i-decided-to-contribute-to-one-open-source-project-every-day-for-a-month-4k0j</link>
      <guid>https://dev.to/bieefilled/what-happened-when-i-decided-to-contribute-to-one-open-source-project-every-day-for-a-month-4k0j</guid>
      <description>&lt;p&gt;Open source software is software that is used, modified, and shared freely. It is a team of developers who work together to develop and improve software. Many of the products and services we rely on every day use open-source software, such as the Linux operating system, the Android mobile operating system, and the Firefox web browser.&lt;/p&gt;

&lt;p&gt;I am a software developer with an interest in open-source software. I’ve supported open-source projects for years, but this was my first Hacktoberfest. Hacktoberfest is an annual event that encourages developers to contribute to open-source projects during the month of October. It’s a great way to support the open-source community and get some cool swag.&lt;/p&gt;

&lt;p&gt;In this blog post, I will share my experience contributing to one open-source project a day for a month.&lt;/p&gt;

&lt;p&gt;I will talk about why I decided to do this challenge, how I found and chose the projects I contributed to, what I learned and did well this month, what challenges and challenges I faced, and what benefits and rewards I gained.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Decided to Contribute to One Open Source Project Every Day for a Month
&lt;/h2&gt;

&lt;p&gt;I decided to contribute to one open source project a day for a month because I wanted to challenge myself and improve my skills as a developer. I wanted to explore new technologies and frameworks that I didn’t know about. And of course, I wanted to have fun and meet new people who also loved open source software.&lt;/p&gt;

&lt;p&gt;I thought contributing to one open source project a day would be a great way to achieve these goals. By doing this, I would expose myself to different projects, problems, and solutions. &lt;br&gt;
I will also learn from other developers who have more experience or knowledge than me. And I will have a positive impact on the projects I’ve helped with.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Found and Chose the Projects That I Contributed To
&lt;/h2&gt;

&lt;p&gt;Finding and choosing the projects that I contributed to was one of the most challenging parts of this month. There are so many great open source projects out there, but not all of them are suitable or interesting for me.&lt;/p&gt;

&lt;p&gt;To find the projects that I contributed to, I used various sources and methods, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/"&gt;Browsing GitHub’s Explore page&lt;/a&gt; , which showcases trending and featured repositories.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/label:hacktoberfest"&gt;Searching GitHub’s Topics page&lt;/a&gt;, which categorizes repositories by topics such as languages, frameworks, platforms, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Following hashtags such as #Hacktoberfest3 or #opensource on Twitter or other social media platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reading blogs or newsletters that feature or review open-source projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Asking for recommendations from friends or colleagues who are also into open-source software.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To choose the projects that I contributed to, I used some criteria and filters, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The project should be related to web development, which is my main area of interest and expertise.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The project should have a clear README file that explains what it is, how it works, how to set it up, how to contribute, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The project should have some issues labeled as “good first issue”, “beginner-friendly”, or “hacktoberfest”, which indicate that they are suitable for new or inexperienced contributors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The project should have an active and welcoming community that responds to questions and feedback.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using these sources, methods, criteria, and filters, I was able to find and choose 31 different open-source projects that matched my preferences and goals.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned and Improved During This Month
&lt;/h2&gt;

&lt;p&gt;During this month, I learned and improved a lot as a developer. Here are some of the skills and technologies that I learned or improved:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python:&lt;/strong&gt; Python is one of my favorite programming languages. It’s versatile, powerful, and easy to learn. During this month, I contributed to several Python-based projects, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new Python framework for movie rating applications This project taught me how to use FastAPI, a modern web framework for building fast and scalable web applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A Python script for dictionary retrieval This project taught me how to use an open-source dictionary library for retrieving meaning, anonymity, and synonyms for a word.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;React:&lt;/strong&gt; is another programming language that I love. It’s a JavaScript library for building user interfaces. During this month, I contributed to several React-based projects&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging:&lt;/strong&gt; Debugging is the process of finding and fixing errors in code. Debugging is an essential skill for any developer, as it helps to improve the quality and functionality of the code. During this month, I improved my debugging skills by using various tools and techniques, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using the browser’s developer tools to inspect the elements, console, network, sources, etc. of a web page or app.&lt;/li&gt;
&lt;li&gt;Using breakpoints to pause the execution of the code and examine the values of variables, expressions, etc.&lt;/li&gt;
&lt;li&gt;Using print statements to display the values of variables, expressions, etc. in the console or terminal.&lt;/li&gt;
&lt;li&gt;Using logging libraries to record the events and errors that occur during the execution of the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code Review:&lt;/strong&gt; Code review is the process of examining and improving code written by others. Code review is an important skill for any developer, as it helps to improve the readability, maintainability, and security of the code. During this month, I improved my code review skills by using various tools and techniques, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using GitHub’s pull request feature to propose changes to a project’s code and get feedback from other contributors.&lt;/li&gt;
&lt;li&gt;Using GitHub’s code review feature to comment on specific lines or sections of code and suggest improvements or corrections.&lt;/li&gt;
&lt;li&gt;Using GitHub’s merge conflict feature to resolve conflicts that occur when two or more contributors make changes to the same file or line of code.&lt;/li&gt;
&lt;li&gt;Using GitHub’s code formatting feature to automatically format the code according to a predefined style guide.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Challenges and Difficulties I Faced During This Month
&lt;/h2&gt;

&lt;p&gt;Despite all the learning and improvement I experienced this month, I also faced some challenges and difficulties. Here are some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finding time:&lt;/strong&gt; Finding time to contribute to one open source project every day was not easy. I had to balance my school, personal life, and other commitments. Sometimes I had to stay up late or wake up early to finish my contributions. Sometimes I had to sacrifice some leisure activities or social events to meet my deadline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finding motivation:&lt;/strong&gt; Finding motivation to contribute to one open source project every day was also difficult. Sometimes I felt bored or tired of working on similar types of projects or problems. Sometimes I have been discouraged by the complexity of certain tasks or issues. At times, I felt overwhelmed or intimidated by the amount or quality of work by other contributors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Learning new things:&lt;/strong&gt; Learning new things was both fun and challenging. Sometimes I had to learn new technologies or frameworks that I didn't. Sometimes I had to learn new concepts or techniques that I didn’t understand. Sometimes I had to learn new good practices or values ​​that I didn’t follow.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Benefits and Rewards I Gained from This Month
&lt;/h2&gt;

&lt;p&gt;Despite all the challenges and difficulties that I faced during this month, I also gained some benefits and rewards. Here are some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improving my skills:&lt;/strong&gt; Improving my skills was one of the main benefits that I gained from this month. By contributing to different types of projects and problems, I was able to improve my skills in various areas, such as Python, React, debugging, code review, etc. I was also able to learn new skills that I didn’t have before, such as FastAPI, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Making an impact:&lt;/strong&gt; Making an impact was another benefit that I gained from this month. By contributing to different types of projects and problems, I was able to make a positive impact on the projects that I contributed to. I was also able to make a positive impact on the users who use these projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Meeting new people:&lt;/strong&gt; Meeting new people was another benefit that I gained from this month. By contributing to different types of projects and problems, I was able to meet new people who share my passion and interest in open-source software. I was also able to learn from them, get feedback from them, and collaborate with them.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;In summary, these initial 18 days of my open-source journey have been enlightening, and filled with challenges, growth, and a heightened dedication to the open-source community. though I have completed my Hacktoberfest challenge and here are verify able PR link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Mrinank-Bhowmick/python-beginner-projects/pull/385"&gt;Built a movie rater app with FastApi:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Would-You-Bot/website/pull/35"&gt;Designed an issue template:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/newtoallofthis123/htmler/pull/12"&gt;Fixed button functionality: &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/newtoallofthis123/htmler/pull/6"&gt;Resolved:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/fb-sean/interactions.js/pull/23"&gt;Improved the read for developer to directly understand:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🌟🚀 #OpenSource #GrowthMindset #opensourcecontributor #hacktober23&lt;/p&gt;

</description>
      <category>hack23contributor</category>
      <category>hacktoberfest23</category>
      <category>hacktoberfest</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Use Robots.txt to Improve Your Website's SEO</title>
      <dc:creator>Samuel Peters</dc:creator>
      <pubDate>Fri, 19 May 2023 11:11:23 +0000</pubDate>
      <link>https://dev.to/bieefilled/how-to-use-robotstxt-to-improve-your-websites-seo-57pc</link>
      <guid>https://dev.to/bieefilled/how-to-use-robotstxt-to-improve-your-websites-seo-57pc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Have you ever wondered how search engines decide what content to show in their search results? Well, websites are regularly scanned and indexed by search engine crawlers. But what if you want some parts of your website to stay private or not be included in search results? This is where the Robots.txt file comes into play. In this blog post, we'll explore what the Robots.txt file is, why it matters, and how it gives website owners control over what search engines can access.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is robots.txt?
&lt;/h2&gt;

&lt;p&gt;A robots.txt file is a text file that tells web crawlers, such as Googlebot, which parts of your website they are allowed to crawl and index. It is a way for website owners to control how their website is crawled and indexed by search engines furthermore It communicates directives to web crawlers about which parts of the website they are allowed to access and index.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why use robots.txt?
&lt;/h2&gt;

&lt;p&gt;There are several reasons why you might want to use a robots.txt file. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Privacy and Security: Robots.txt plays a crucial role in maintaining privacy and security for a website. It helps prevent sensitive or confidential information from being accessed by search engine crawlers, ensuring that only intended audiences can access certain parts of the website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Preventing Duplicate Content: If multiple versions of a website exist (e.g., &lt;a href="http://www.example.com"&gt;www.example.com&lt;/a&gt; and example.com), search engines might consider them as separate entities and index both versions. By utilizing Robots.txt, website owners can specify which version should be crawled and indexed, avoiding duplicate content issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Resource Optimization: Some parts of a website, such as large media files or dynamically generated pages, may consume significant server resources. By disallowing search engine crawlers from accessing these resource-intensive areas, website owners can improve server performance and enhance the overall user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Proper Implementation: To effectively utilize Robots.txt, it's essential to follow best practices and avoid common mistakes. Some key considerations include ensuring the Robots.txt file is accessible, using correct syntax, and regularly reviewing and updating the directives to align with website changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  How to create a robots.txt file
&lt;/h2&gt;

&lt;p&gt;Robots.txt uses a straightforward syntax and specific directives to instruct search engine crawlers. The two main directives are "Disallow" and "Allow." The "Disallow" directive tells crawlers which areas of the site to avoid, while the "Allow" directive provides exceptions to the "Disallow" rule.&lt;br&gt;
example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User-agent: Googlebot
Allow: /images 

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best practices for robots.txt files
&lt;/h2&gt;

&lt;p&gt;Here are some best practices for creating and using robots.txt files:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep your robots.txt file simple&lt;/strong&gt;. There is no need to add complex rules to your robots.txt file. The simpler the file, the easier it will be for web crawlers to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use absolute paths.&lt;/strong&gt; When specifying paths in your robots.txt file, use absolute paths, not relative paths. Absolute paths start with a forward slash (/), while relative paths do not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update your robots.txt file regularly.&lt;/strong&gt; If you add new pages to your website, or if you change the structure of your website, be sure to update your robots.txt file accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; The Robots.txt file is a valuable tool that empowers website owners to control how search engine crawlers access and index their content. By implementing a well-structured and properly maintained Robots.txt file, you can safeguard sensitive information, prevent duplicate content issues, optimize server resources, and enhance your website's overall performance and visibility in search engine results.&lt;/p&gt;

&lt;p&gt;Remember, while Robots.txt is a powerful tool, it is not foolproof. It relies on the cooperation of search engine crawlers to abide by the directives. Therefore, it's important to combine the use of Robots.txt with other appropriate security measures and SEO strategies to fully protect and optimize your website.&lt;/p&gt;

&lt;p&gt;By understanding and effectively utilizing Robots.txt, you can take control of your website's visibility and ensure that it aligns with your specific needs and objectives.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>webdev</category>
      <category>seo</category>
      <category>security</category>
    </item>
    <item>
      <title>Building and Publishing a React Component with Vite and NPM</title>
      <dc:creator>Samuel Peters</dc:creator>
      <pubDate>Wed, 03 May 2023 02:38:59 +0000</pubDate>
      <link>https://dev.to/bieefilled/building-and-publishing-a-react-component-with-vite-and-npm-1npd</link>
      <guid>https://dev.to/bieefilled/building-and-publishing-a-react-component-with-vite-and-npm-1npd</guid>
      <description>&lt;p&gt;React has become one of the most popular front-end frameworks due to its component-based architecture, and with the ease of sharing packages through Npm, building and sharing your own React components has never been easier.&lt;br&gt;
In this guide, we'll walk you through the steps of building your own React component from scratch, using the Vite-React framework to streamline the process. We'll cover everything from setting up your development environment to publishing your component on NPM, ensuring that it is both functional and accessible for other developers to use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Here are some prerequisites you need to have before diving into building a React component with Vite and publishing it on npm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Basic knowledge of React, JavaScript, and NPM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Node.js installed on your machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An N.P.M account to publish your package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A GitHub Account for Hosting your Hosting your code repository&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To get started, we'll create a new React project using Vite. Vite is a build tool that is optimized for frontend development, and it provides a fast and easy way to set up a new React project.&lt;br&gt;
First, let's create a new directory for our project and navigate to it in the terminal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
First Step is to initialize the Vite-React package in our project directory by running the following command:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn create Vite react-library-scaffold 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;follow the prompt using the arrow key to navigate to react and javascript&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fb69l9rhorqk7888e2rzo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fb69l9rhorqk7888e2rzo.png" alt="Image description" width="568" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Next navigate to the newly created Folder and run the yarn to install the react dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbqpfrynlrad3s851swfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbqpfrynlrad3s851swfb.png" alt="Image description" width="603" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On completion your file structure should look like this &lt;br&gt;
&lt;a href="https://media2.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%2Ffar6wjdswqkw3xk1qvwa.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffar6wjdswqkw3xk1qvwa.PNG" alt="Image description" width="195" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Next step is to add more information to the package.Json file and modify our vite.config.js files
open your terminal and type &lt;code&gt;npm init&lt;/code&gt; and enter the name of the library, descriptions, authors ... the new code block should look like this.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "react-library-scafold",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@vitejs/plugin-react": "^4.0.0",
    "eslint": "^8.38.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.3.4",
    "vite": "^4.3.2"
  },
  "description": "A react-Library-Scaffold",
  "main": "vite.config.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Petsamuel/react-library-scaffold.git"
  },
  "keywords": [
    "react",
    "components"
  ],
  "author": "Peter Samuel",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/Petsamuel/react-library-scaffold/issues"
  },
  "homepage": "https://github.com/Petsamuel/react-library-scaffold#readme"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Add this Block code to your Package.json&lt;br&gt;
it's specifying where the build folder needed for the component should be stored.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "main": "./dist/react-library-scaffold.umd.js",
  "module": "./dist/react-library-scaffold.es.js",
  "exports": {
    ".": {
      "import": "./dist/react-library-scaffold.es.js",
      "require": "./dist/react-library-scaffold.umd.js"
    }
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Next step is to install test dependencies vite, react-test-renderer
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @testing-library/dom @testing-library/react c8 eslint eslint-plugin-react jsdom react-test-renderer vitest --save-dev

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

&lt;/div&gt;



&lt;p&gt;then add the test script to your package.json file&lt;br&gt;
&lt;a href="https://media2.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%2Fygdlj3ictugceq7sdo3a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fygdlj3ictugceq7sdo3a.PNG" alt="Image description" width="584" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Next step is configuring the Vite.config.jsx file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;add this block of code there&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import path from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  build: {
    lib: {
      entry: path.resolve("src", 'src/components/index.jsx'),
      name: 'react-library-scaffold',
      fileName: (format) =&amp;gt; `react-library-scaffold.${format}.js`
    },
    rollupOptions: {
      external: ['react', 'react-dom'],
      output: {
        globals: {
          react: 'React'
        }
      }
    }
  },
  plugins: [react()]
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure you replace name: &lt;code&gt;'react-library-scaffold'&lt;/code&gt; with the name of your component&lt;/p&gt;

&lt;p&gt;Likewise, make sure that &lt;code&gt;react-library-scaffold&lt;/code&gt; in the filename value is changed to the name of your component&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure Testing
&lt;/h2&gt;

&lt;p&gt;create a vitest.config.js file in your root folder and add the following code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite'

export default defineConfig({
  test: {
    globals: false,
    environment: 'jsdom'
  }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating Components along with Tests Snapshots
&lt;/h2&gt;

&lt;p&gt;The entry point for your component is /src/components/index.jsx. &lt;/p&gt;

&lt;p&gt;For now you we want to create a dummy HelloWorld component as in the examples below, then once the development environment is set up, come back and build your component.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create your component in /src/component/index.jsx. Here's a very simple example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

export default function Greeting(props) {
  const {
    message= 'World'
  } = props

  return (
    &amp;lt;div&amp;gt;Hello, {greeting}!&amp;lt;/div&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add test
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import renderer from 'react-test-renderer'
import { describe, expect, it} from 'vitest'
import Greeting from './index'

describe('Greeting component', () =&amp;gt; {
  it('Greeting component renders correctly', () =&amp;gt; {
    const component = renderer.create(
      &amp;lt;Greeting/&amp;gt;
    )

    const tree = component.toJSON()

    expect(tree).toMatchSnapshot()
  })

  it(' prop working', () =&amp;gt; {
    const component = renderer.create(
      &amp;lt;Greeting message={'Universe'} /&amp;gt;
    )

    const tree = component.toJSON()

    expect(tree).toMatchSnapshot()
  })
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run your tests by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or you can run tests and set a watch to re-run tests when anything changes.&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 watch

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

&lt;/div&gt;



&lt;p&gt;now open the main.jsx and create a component &lt;br&gt;
sample code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import Greeting from './components'

const App = () =&amp;gt; {
  return (
    &amp;lt;Greeting message={'Universe'} /&amp;gt;
  )
}

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

&lt;/div&gt;



&lt;p&gt;now run the development server using &lt;br&gt;
&lt;code&gt;npm run dev&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Writing a Customized Readme
&lt;/h2&gt;

&lt;p&gt;To make it easy for other developers to use your component, it's crucial to create a high-quality README file that contains comprehensive documentation, usage examples, and highlights the features and advantages of using your component.&lt;/p&gt;

&lt;p&gt;Open /src/README.md&lt;/p&gt;

&lt;p&gt;Create your README file using markdown.&lt;/p&gt;
&lt;h2&gt;
  
  
  Pushing to a GitHub repository:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a new repository on GitHub.&lt;/li&gt;
&lt;li&gt;Initialize a Git repository in your project folder &lt;code&gt;using git init.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add all files to the repository using &lt;code&gt;git add .&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Commit your changes using &lt;code&gt;git commit -m "Initial commit"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Set the remote origin to your GitHub repository &lt;code&gt;using git remote add origin &amp;lt;repository-url&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Push your code to the repository using &lt;code&gt;git push -u origin main&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sure, adding a quick guide on creating an npm account (or Yarn, which uses npm's registry) can be helpful, especially for beginners. Here’s how to add that section to your guide.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating an Account on npm (or Yarn)
&lt;/h2&gt;

&lt;p&gt;To publish your React component on npm, you’ll first need an npm account. Here’s a quick walkthrough on setting one up:&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Sign Up for an npm Account
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="https://www.npmjs.com/" rel="noopener noreferrer"&gt;npm website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Sign Up&lt;/strong&gt; in the top-right corner.&lt;/li&gt;
&lt;li&gt;Fill out the required information, including your username, password, and email address.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create an account&lt;/strong&gt; and confirm your email if prompted.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Step 2: Login on the Command Line
&lt;/h3&gt;

&lt;p&gt;Once your account is created, you’ll need to log in through the command line:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal.&lt;/li&gt;
&lt;li&gt;Run the following command:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Enter your npm username, password, and email address when prompted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After successfully logging in, your npm account is linked to your terminal session, and you're ready to publish packages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Yarn users can also follow the same steps, as Yarn uses npm’s registry. So logging in to npm will allow you to publish packages via either npm or Yarn.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, with your npm account set up, you can continue to the next step in the guide: publishing your component.&lt;/p&gt;
&lt;h2&gt;
  
  
  Publishing to npm
&lt;/h2&gt;

&lt;p&gt;We are finally ready to publish our component to npm.&lt;/p&gt;

&lt;p&gt;To ensure a smooth publishing process, it is important to follow this checklist:&lt;/p&gt;

&lt;p&gt;Verify that the version number in your package.json file is accurate and adheres to the semantic versioning convention. Each npm publication should have a unique version number.&lt;/p&gt;

&lt;p&gt;Ensure all tests pass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the build files:&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 build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;UMD and ESM module formats are created and placed in the /dist folder. Again, note that React is not bundled in alongside your component. Just your component code and any dependencies.&lt;/p&gt;

&lt;p&gt;Ensure you are logged into npm or yarn. If not type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; npm login or yarn login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Publish your component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; npm publish or yarn publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And all done!&lt;br&gt;
All the code in this guide is available in the &lt;a href="https://github.com/Petsamuel/react-library-scaffold.git" rel="noopener noreferrer"&gt;repository on Github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>vite</category>
      <category>npm</category>
      <category>node</category>
    </item>
  </channel>
</rss>
