<?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:  Tijani Olagunju</title>
    <description>The latest articles on DEV Community by  Tijani Olagunju (@626tech).</description>
    <link>https://dev.to/626tech</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%2F3305830%2F03f38b93-4172-431a-8dd3-b20a38f78afd.png</url>
      <title>DEV Community:  Tijani Olagunju</title>
      <link>https://dev.to/626tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/626tech"/>
    <language>en</language>
    <item>
      <title>Understanding JSX in React: A Friendly Guide</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Thu, 17 Jul 2025 08:38:40 +0000</pubDate>
      <link>https://dev.to/626tech/understanding-jsx-in-react-a-friendly-guide-573p</link>
      <guid>https://dev.to/626tech/understanding-jsx-in-react-a-friendly-guide-573p</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;W&lt;/strong&gt;elcome! If you're learning React, you've likely encountered something that looks like HTML wrapped in JavaScript — that's &lt;strong&gt;JSX&lt;/strong&gt;. At first glance, JSX can feel confusing. You might ask, &lt;em&gt;“Is this JavaScript?&lt;/em&gt; &lt;em&gt;Is it HTML?&lt;/em&gt; &lt;em&gt;Why is it here?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This guide is here to support you through that uncertainty. We’ll walk through JSX together with a clear focus on understanding the why and the how, not just the what. By the end, JSX will feel like a familiar and powerful friend — not a mysterious stranger.&lt;br&gt;
Let’s dive in with clarity and confidence.&lt;/p&gt;


&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What is JSX?&lt;/li&gt;
&lt;li&gt;Why Use JSX in React?&lt;/li&gt;
&lt;li&gt;JSX vs HTML: Key Differences&lt;/li&gt;
&lt;li&gt;Embedding JavaScript in JSX&lt;/li&gt;
&lt;li&gt;JSX Best Practices&lt;/li&gt;
&lt;li&gt;Common Mistakes and How to Avoid Them&lt;/li&gt;
&lt;li&gt;Conclusion and Encouragement&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  1. What is JSX?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JSX&lt;/strong&gt; stands for &lt;strong&gt;JavaScript XML&lt;/strong&gt;. It's a syntax extension for JavaScript, and it's used with React to describe what the UI should look like.&lt;/p&gt;

&lt;p&gt;In simpler terms, JSX lets you write HTML-like code inside your JavaScript.&lt;/p&gt;
&lt;h2&gt;
  
  
  Example:
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = &amp;lt;h1&amp;gt;Hello, world!&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Behind the scenes, JSX is transformed into regular JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = React.createElement('h1', null, 'Hello, world!');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This transformation happens during the build process, so you can write declarative code that's easy to read and reason about.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why Use JSX in React?
&lt;/h2&gt;

&lt;p&gt;JSX might seem optional, but it brings several benefits:&lt;br&gt;
✅ &lt;strong&gt;Declarative Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSX lets you describe what you want to render, rather than how to create it step by step.&lt;br&gt;
✅ &lt;strong&gt;Familiarity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve written HTML before, JSX feels comfortable — you’re already halfway there.&lt;br&gt;
✅ &lt;strong&gt;Tighter Integration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSX enables tight integration between layout and logic. You don’t have to switch contexts between languages.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. JSX vs HTML: Key Differences
&lt;/h2&gt;

&lt;p&gt;Even though JSX looks like HTML, it has some important differences:&lt;/p&gt;
&lt;h4&gt;
  
  
  1. className instead of class
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong
&amp;lt;div class="container"&amp;gt;Hello&amp;lt;/div&amp;gt;

// Right
&amp;lt;div className="container"&amp;gt;Hello&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is because &lt;code&gt;class&lt;/code&gt; is a reserved word in JavaScript.&lt;/p&gt;


&lt;h4&gt;
  
  
  2. Self-Closing Tags Required
&lt;/h4&gt;

&lt;p&gt;JSX requires tags that don’t have children to be self-closed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong
&amp;lt;input&amp;gt;

// Right
&amp;lt;input /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  3. camelCase for Event Handlers and Attributes
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// HTML
&amp;lt;button onclick="handleClick()"&amp;gt;Click&amp;lt;/button&amp;gt;

// JSX
&amp;lt;button onClick={handleClick}&amp;gt;Click&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Embedding JavaScript in JSX
&lt;/h2&gt;

&lt;p&gt;You can embed JavaScript expressions inside JSX using curly braces &lt;code&gt;{}&lt;/code&gt;. This is one of JSX's most powerful features.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const name = "Alice";
const greeting = &amp;lt;h1&amp;gt;Hello, {name}!&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use conditional rendering:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isLoggedIn = true;
const message = &amp;lt;p&amp;gt;{isLoggedIn ? "Welcome back!" : "Please sign in."}&amp;lt;/p&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or loop through data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const items = ["Apple", "Banana", "Cherry"];
const list = (
  &amp;lt;ul&amp;gt;
    {items.map(item =&amp;gt; &amp;lt;li key={item}&amp;gt;{item}&amp;lt;/li&amp;gt;)}
  &amp;lt;/ul&amp;gt;
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JSX is expressive and blends logic with markup beautifully.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. JSX Best Practices
&lt;/h2&gt;

&lt;p&gt;Here are a few friendly tips to keep your JSX clean and effective:&lt;br&gt;
✅ &lt;strong&gt;Use Meaningful Names&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Name components and variables clearly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const WelcomeMessage = () =&amp;gt; &amp;lt;h1&amp;gt;Welcome!&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Keep Components Small&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Break complex UIs into small, reusable components.&lt;br&gt;
✅ &lt;strong&gt;Use Fragments When Needed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a component returns multiple elements, wrap them in &lt;code&gt;&amp;lt;&amp;gt;...&amp;lt;/&amp;gt;&lt;/code&gt; instead of an unnecessary &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;&amp;gt;
  &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;
  &amp;lt;p&amp;gt;Welcome back.&amp;lt;/p&amp;gt;
&amp;lt;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6. Common Mistakes and How to Avoid Them
&lt;/h2&gt;

&lt;p&gt;Here are some common pitfalls beginners face — and how to steer clear:&lt;br&gt;
❌ &lt;strong&gt;Forgetting to Return in Arrow Functions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong
const MyComponent = () =&amp;gt; {
  &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;;
};

// Right
const MyComponent = () =&amp;gt; {
  return &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;;
};

// Or use implicit return:
const MyComponent = () =&amp;gt; &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;❌ &lt;strong&gt;Using if/else Inside JSX&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSX doesn't support full statements (like &lt;code&gt;if&lt;/code&gt;). Use ternary operators or move logic outside.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Not allowed
{ if (loggedIn) { return &amp;lt;p&amp;gt;Hi!&amp;lt;/p&amp;gt;; } }

// Instead
{loggedIn ? &amp;lt;p&amp;gt;Hi!&amp;lt;/p&amp;gt; : &amp;lt;p&amp;gt;Please log in.&amp;lt;/p&amp;gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;❌ &lt;strong&gt;Not Using Keys in Lists&lt;/strong&gt;&lt;br&gt;
When rendering lists, always provide a &lt;code&gt;key&lt;/code&gt; to each item.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;items.map(item =&amp;gt; &amp;lt;li key={item}&amp;gt;{item}&amp;lt;/li&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  7. Conclusion and Encouragement
&lt;/h2&gt;

&lt;p&gt;JSX is a cornerstone of React development, and it’s perfectly normal to feel a little unsure at the start. The good news? JSX becomes intuitive with practice. Every time you write a line of JSX, you're building both your understanding and your confidence.&lt;/p&gt;

&lt;p&gt;As you continue learning React, keep experimenting, breaking things, and building small projects. You'll be amazed how quickly JSX becomes second nature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And remember — you’re doing great.&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why Use Java for Backend?</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Mon, 14 Jul 2025 21:05:03 +0000</pubDate>
      <link>https://dev.to/626tech/why-use-java-for-backend-3le3</link>
      <guid>https://dev.to/626tech/why-use-java-for-backend-3le3</guid>
      <description>&lt;p&gt;Java is great for back-end development. They handle many requests simultaneously while maintaining performance and reliability. I will explain in the steps listed below:&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Introduction&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2. Stability and Reliability&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3. Scalability for Enterprise Applications&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;4. Robust Ecosystem and Framework Support&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;5. Strong Typing and Maintainability&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;6. Security and Performance&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;7. Community and Talent Pool&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;8. Example: Basic Java Backend Setup&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;Choosing a backend language is a foundational decision that affects scalability, maintenance, and long-term success. Java remains one of the most trusted options for backend development. This guide explores why many teams and enterprises still rely on Java, offering reassurance and practical insights for making informed choices.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Stability and Reliability
&lt;/h2&gt;

&lt;p&gt;Java’s long-standing reputation comes from decades of refinement and usage across mission-critical systems. Developers choose Java because it behaves predictably under pressure. The JVM (Java Virtual Machine) ensures consistent behavior across platforms, making Java highly reliable for backend operations.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Scalability for Enterprise Applications
&lt;/h2&gt;

&lt;p&gt;Java was built with scalability in mind. It handles concurrent users and large datasets efficiently, which makes it suitable for growing applications. Whether scaling horizontally (across servers) or vertically (within powerful hardware), Java's performance remains dependable.&lt;/p&gt;


&lt;h2&gt;
  
  
  4. Robust Ecosystem and Framework Support
&lt;/h2&gt;

&lt;p&gt;Java offers mature and widely used frameworks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Spring Boot for microservices and REST APIs,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hibernate for object-relational mapping,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Jakarta EE for enterprise specifications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools streamline backend development and reduce boilerplate code, empowering developers to focus on business logic.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Strong Typing and Maintainability
&lt;/h2&gt;

&lt;p&gt;Java’s statically-typed nature enforces discipline. Type-checking at compile time catches many errors early. This leads to code that is easier to debug, refactor, and maintain—especially in large teams or legacy systems.&lt;/p&gt;


&lt;h2&gt;
  
  
  6. Security and Performance
&lt;/h2&gt;

&lt;p&gt;Java provides robust built-in security features like bytecode verification, secure class loading, and an extensive set of cryptographic APIs. Combined with Just-In-Time (JIT) compilation and modern garbage collection, Java achieves excellent runtime performance.&lt;/p&gt;


&lt;h2&gt;
  
  
  7. Community and Talent Pool
&lt;/h2&gt;

&lt;p&gt;Java has one of the largest global communities. A vast pool of skilled developers, extensive documentation, and mature libraries mean you're never alone when facing a problem. Whether hiring or learning, Java's ecosystem supports your growth.&lt;/p&gt;


&lt;h2&gt;
  
  
  8. Example: Basic Java Backend Setup
&lt;/h2&gt;

&lt;p&gt;Below is a simple setup using &lt;code&gt;Spring Boot&lt;/code&gt; to create a REST API in Java.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// File: HelloController.java
package com.example.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String sayHello() {
        return "Hello from Java backend!";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;








&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// File: DemoApplication.java
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Steps to Run:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Set up a Maven or Gradle project.&lt;/li&gt;
&lt;li&gt;Add Spring Boot dependencies.&lt;/li&gt;
&lt;li&gt;Compile and run using &lt;code&gt;./mvnw spring-boot:run&lt;/code&gt; or &lt;code&gt;./gradlew bootRun.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Access &lt;code&gt;http://localhost:8080/hello&lt;/code&gt; in your browser or Postman.&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;If your goal is to build robust, secure, and scalable backends with long-term viability, Java is a proven and dependable choice. It supports teams with clarity, consistency, and a deep pool of tools and expertise.&lt;br&gt;
engage me with your questions...&lt;br&gt;
&lt;em&gt;"What do you think are the key advantages of using Java for backend development, and how do they compare to other popular backend languages?"&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How To Build Responsive Websites Including Best Practices</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Wed, 09 Jul 2025 11:03:55 +0000</pubDate>
      <link>https://dev.to/626tech/how-to-build-responsive-websites-including-best-practices-4mo6</link>
      <guid>https://dev.to/626tech/how-to-build-responsive-websites-including-best-practices-4mo6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Y&lt;/strong&gt;ou are welcome to this brief guide documented on &lt;br&gt;
       &lt;strong&gt;"How To Build Responsive Websites Including Best Practices."&lt;/strong&gt;&lt;br&gt;
  You will learn useful tips Web designers utilize to create a user friendly website. The prerequisites you need are &lt;code&gt;HTML&lt;/code&gt; and &lt;code&gt;CSS&lt;/code&gt;. The table of contents is presented below:&lt;/p&gt;


&lt;h2&gt;
  
  
  Table of Contents:
&lt;/h2&gt;
&lt;h4&gt;
  
  
  1. Introduction
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Explains the importance of responsive design and its impact on user experience across devices. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  2. Understanding Responsive Web Design (RWD)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Introduces the concept of RWD, including the principles of flexible layouts, media queries, and fluid images.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  3. Best Practices for Building Responsive Websites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A breakdown of essential techniques such as mobile-first design, viewport settings, and responsive typography.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  4. Common Tools and Frameworks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A review of widely used tools like &lt;code&gt;CSS Grid&lt;/code&gt;, &lt;code&gt;Flexbox&lt;/code&gt;, and frameworks such as &lt;code&gt;Bootstrap&lt;/code&gt; and &lt;code&gt;Tailwind CSS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  5. Testing Responsiveness Across Devices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Guidance on how to test and refine your website for different screen sizes using emulators and real devices.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  6.Code Examples and Illustrations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hands-on code snippets demonstrating key responsive design techniques&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  7.Conclusion
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A wrap-up emphasizing continued learning and empathy for diverse users.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  1. Introduction
&lt;/h4&gt;

&lt;p&gt;In a world where users browse the web on phones, tablets, laptops, and desktops, a one-size-fits-all approach no longer suffices. Responsive web design ensures that content and layout adapt gracefully to the user’s screen. This essay aims to guide aspiring developers and designers with practical and compassionate advice on how to create websites that welcome everyone, regardless of their device.&lt;/p&gt;


&lt;h4&gt;
  
  
  2. Understanding Responsive Web Design (RWD)
&lt;/h4&gt;

&lt;p&gt;Responsive Web Design is a design philosophy that emphasizes flexibility. Rather than designing fixed layouts, developers create adaptable layouts that adjust according to the screen size.&lt;br&gt;
&lt;strong&gt;Core principles:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fluid grids:&lt;/strong&gt; Elements use relative units like percentages rather than fixed units like pixels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible images:&lt;/strong&gt; Images scale with the size of their containers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media queries:&lt;/strong&gt; &lt;code&gt;CSS&lt;/code&gt; rules that change the layout depending on the screen’s dimensions.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  3. Best Practices for Building Responsive Websites
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;a. Start with Mobile-First Design&lt;/strong&gt;&lt;br&gt;
Begin by designing for the smallest screen. This ensures your content is prioritized and clutter-free.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Base styles for mobile */
body {
  font-size: 16px;
  padding: 1rem;
}

/* Styles for tablets and up */
@media (min-width: 768px) {
  body {
    font-size: 18px;
  }
}

/* Styles for desktops and up */
@media (min-width: 1024px) {
  body {
    font-size: 20px;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;b. Set the Viewport Correctly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Always define the viewport to ensure your layout behaves correctly on mobile devices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;c. Use Relative Units&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prefer &lt;code&gt;em&lt;/code&gt;, &lt;code&gt;rem&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;, or &lt;code&gt;vh/vw&lt;/code&gt; over &lt;code&gt;px&lt;/code&gt; to allow flexible scaling.&lt;br&gt;
&lt;strong&gt;d. Prioritize Content&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Users on mobile may have limited time or bandwidth. Display key information prominently.&lt;/p&gt;


&lt;h4&gt;
  
  
  4. Common Tools and Frameworks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS Grid:&lt;/strong&gt; Ideal for complex, two-dimensional layouts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flexbox:&lt;/strong&gt; Excellent for arranging items in one dimension (row or column).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bootstrap:&lt;/strong&gt; Provides responsive components and a 12-column grid system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tailwind CSS:&lt;/strong&gt; Utility-first framework for responsive design with minimal effort.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example using &lt;code&gt;Flexbox&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  flex-wrap: wrap;
}

.item {
  flex: 1 1 300px; /* Grow and shrink, base size 300px */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  5. Testing Responsiveness Across Devices
&lt;/h4&gt;

&lt;p&gt;Designing is only half the job—testing ensures reliability.&lt;br&gt;
&lt;strong&gt;Tools to Use:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome DevTools: Simulates various screen sizes and throttles network speed.&lt;/li&gt;
&lt;li&gt;BrowserStack: Offers real-device testing.&lt;/li&gt;
&lt;li&gt;Responsive Design Mode (Firefox): Easy screen size switching.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regularly test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Orientation changes&lt;/li&gt;
&lt;li&gt;Clickability of buttons&lt;/li&gt;
&lt;li&gt;Legibility of text&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  6. Code Examples and Illustrations
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Responsive Image:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img src="example.jpg" alt="A tree in the field" style="
max-width: 100%; height: auto;"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Grid Layout with Media Queries:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.grid-container {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr 1fr;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Illustration: Layout Shift&lt;/strong&gt;&lt;br&gt;
On small screens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Image]
[Text]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On larger screens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Image] [Text]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  7. Conclusion/Resources
&lt;/h4&gt;

&lt;p&gt;Designing responsive websites is not just about technology—it’s about people. It’s about ensuring that someone using a low-end smartphone on a 3G connection can access your content as easily as someone on a high-end laptop. By following best practices, staying curious, and caring about user experience, you contribute to a more inclusive web.&lt;br&gt;
&lt;strong&gt;Learning resources-&lt;/strong&gt; there are additional abundant collection of resources just from a google search on any topic of your choice.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Build a React Component from Scratch: A Gentle Guide</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Fri, 04 Jul 2025 11:49:25 +0000</pubDate>
      <link>https://dev.to/626tech/how-to-build-a-react-component-from-scratch-a-gentle-guide-1pdf</link>
      <guid>https://dev.to/626tech/how-to-build-a-react-component-from-scratch-a-gentle-guide-1pdf</guid>
      <description>&lt;p&gt;&lt;strong&gt;W&lt;/strong&gt;elcome to this guide I prepared to walk you through creating a react component from scratch. The only prerequisites you need are basic &lt;code&gt;HTML&lt;/code&gt;, &lt;code&gt;CSS&lt;/code&gt;, and &lt;code&gt;JavaScript&lt;/code&gt; foundational knowledge. Let's get to business...&lt;/p&gt;




&lt;h1&gt;
  
  
  Table of Contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Introduction: You’re Not Alone in This&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;A welcoming note to ease apprehension.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What Is a &lt;code&gt;React&lt;/code&gt; Component?&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Understanding the foundation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setting Up Your Environment&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Tools and setup made simple.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creating Your First Component&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Step-by-step guide to your first working piece.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling the Component&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Ways to add aesthetic with ease.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managing State and Props&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Making your component dynamic.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Practices and Troubleshooting&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Tips to write clean, resilient code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conclusion: You Did It!&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;A reflection and encouragement for what comes next.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  1. Introduction: You’re Not Alone in This
&lt;/h1&gt;

&lt;p&gt;Learning to build a &lt;code&gt;React&lt;/code&gt; component from scratch can feel like stepping into a vast and unfamiliar world. If you’ve found yourself unsure where to start—or frustrated because things don’t “just work”—please know this: you are not alone. Every expert React developer was once a beginner. This guide is written to hold your hand through the process, no assumptions, no judgement—just encouragement and clarity.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. What Is a &lt;code&gt;React&lt;/code&gt; Component?
&lt;/h1&gt;

&lt;p&gt;A &lt;code&gt;React&lt;/code&gt; component is the building block of a &lt;code&gt;React&lt;/code&gt; application. Think of it as a modular piece of &lt;code&gt;UI&lt;/code&gt;—a button, a card, a form field—that encapsulates logic, layout, and style. There are two main types:&lt;br&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function Components:&lt;/strong&gt; Modern, simpler, and the current best practice.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Class Components:&lt;/strong&gt; Older, more verbose, but still used in legacy codebases.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll focus on &lt;strong&gt;function components&lt;/strong&gt; because they’re simpler and more intuitive for newcomers.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Setting Up Your Environment
&lt;/h1&gt;

&lt;p&gt;Before writing any code, let’s ensure your development environment is ready:&lt;/p&gt;

&lt;h3&gt;
  
  
  What You Need:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node.js and npm:&lt;/strong&gt; You can download them from nodejs.org.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Editor:&lt;/strong&gt; Visual Studio Code is widely used and beginner-friendly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create React App:&lt;/strong&gt; An official starter pack to set up your project fast.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Steps:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal.
&lt;/li&gt;
&lt;li&gt;Run:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npx create-react-app my-first-component
    cd my-first-component
    npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Your browser should open with the default React app—success!&lt;br&gt;&lt;br&gt;
If anything feels overwhelming at this point, pause. Take a deep breath. You’re doing just fine.&lt;/p&gt;


&lt;h1&gt;
  
  
  4. Creating Your First Component
&lt;/h1&gt;

&lt;p&gt;Let’s create a simple &lt;code&gt;Greeting&lt;/code&gt; component that says hello to a user.&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step-by-Step:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Inside your project’s &lt;code&gt;src/&lt;/code&gt; folder, create a new file: &lt;code&gt;Greeting.js&lt;/code&gt; &lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the following code:&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import React from 'react';

function Greeting() {
  return &amp;lt;h1&amp;gt;Hello, welcome to your first component!&amp;lt;/h1&amp;gt;;
}

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

&lt;/div&gt;


&lt;p&gt;3.In &lt;code&gt;App.js&lt;/code&gt;, import and use it:&lt;br&gt;&lt;br&gt;
&lt;/p&gt;

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

    function App() {
      return (
        &amp;lt;div&amp;gt;
          &amp;lt;Greeting /&amp;gt;
        &amp;lt;/div&amp;gt;
      );
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why This Works:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;We define a function named &lt;code&gt;Greeting&lt;/code&gt; that returns &lt;code&gt;JSX&lt;/code&gt;(
a syntax extension that looks like &lt;code&gt;HTML&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;We export it so it can be used in other parts of the app.&lt;/li&gt;
&lt;li&gt;We import and include &lt;code&gt;&amp;lt;Greeting /&amp;gt;&lt;/code&gt;in our main app file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Congratulations—you’ve just built a React component!&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Styling the Component
&lt;/h1&gt;

&lt;p&gt;Styling helps make your UI approachable and personal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inline Styling:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return &amp;lt;h1 style={{ color: 'blue' }}&amp;gt;Hello, styled component!&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using CSS Files:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create &lt;code&gt;Greeting.css&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.greeting-text {
  color: teal;
  font-size: 24px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Modify &lt;code&gt;Greeting.js:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    import './Greeting.css';

    function Greeting() {
      return &amp;lt;h1 className="greeting-text"&amp;gt;Hello with CSS!&amp;lt;/h1&amp;gt;;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both options are valid—choose what feels manageable for you as you learn.&lt;/p&gt;




&lt;h1&gt;
  
  
  6. Managing State and Props
&lt;/h1&gt;

&lt;p&gt;Now let’s add &lt;strong&gt;props&lt;/strong&gt; to personalize the message and &lt;strong&gt;state&lt;/strong&gt; to make it interactive.&lt;/p&gt;

&lt;h3&gt;
  
  
  With Props:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Greeting({ name }) {
  return &amp;lt;h1&amp;gt;Hello, {name}!&amp;lt;/h1&amp;gt;;
}

// Use in App.js
&amp;lt;Greeting name="Alex" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  With State:
&lt;/h3&gt;



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

function Greeting() {
  const [name, setName] = useState('Alex');

  return (
    &amp;lt;&amp;gt;
      &amp;lt;h1&amp;gt;Hello, {name}!&amp;lt;/h1&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; setName('Taylor')}&amp;gt;Change Name&amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;React&lt;/code&gt; helps you keep track of values that can change—like a name after a button click. If this feels like a leap, it’s okay. Repetition and small experiments will make it second nature.&lt;/p&gt;




&lt;h1&gt;
  
  
  7. Best Practices and Troubleshooting
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Keep in Mind:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name Components with Capitals:&lt;/strong&gt; &lt;code&gt;React&lt;/code&gt; treats lowercase tags like built-in &lt;code&gt;HTML&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return One Root Element:&lt;/strong&gt; Wrap &lt;code&gt;JSX&lt;/code&gt; in a single parent, like &lt;code&gt;&amp;lt;
div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Meaningful Names:&lt;/strong&gt; Components like &lt;code&gt;UserCard&lt;/code&gt;, &lt;code&gt;Header&lt;/code&gt;, &lt;code&gt;LoginForm&lt;/code&gt; tell their own story.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When Things Break:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read Error Messages Slowly:&lt;/strong&gt; Often they guide you to the exact line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Restart the Server:&lt;/strong&gt; Sometimes &lt;code&gt;Ctrl + C&lt;/code&gt; and &lt;code&gt;npm start&lt;/code&gt; again solves mysterious issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Google the Error:&lt;/strong&gt; Every error you’ll meet has likely been solved publicly already.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  8. Conclusion: You Did It!
&lt;/h1&gt;

&lt;p&gt;You’ve written your first component, styled it, passed in props, used state, and survived a few quirks along the way. That’s not just technical progress—it’s emotional growth, too. Learning to code is as much about confidence as it is about syntax.&lt;/p&gt;

&lt;p&gt;Whether you're still unsure or feeling victorious, this is a huge milestone. Take a break, hydrate, and remember: you’re building something powerful, one component at a time.&lt;br&gt;&lt;br&gt;
For additional resources on YouTube Check out these tutorials:&lt;em&gt;@programming with mosh&lt;/em&gt; &lt;strong&gt;--React Tutorial for Beginners--&lt;/strong&gt; &lt;em&gt;@useful programmer&lt;/em&gt; &lt;strong&gt;--Write a React Component from Scratch - React - Free Code Camp--&lt;/strong&gt;. &lt;br&gt;
Follow me for more updates and type in your  questions and feedback in the Comment box. &lt;/p&gt;

&lt;p&gt;With that we come to the end of this guide.&lt;br&gt;
&lt;em&gt;"What are the key steps and considerations you take into account when building a React component from scratch, and how do you ensure it remains reusable and maintainable?"&lt;/em&gt; Comment your suggestions below&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>What is the useRef Hook in React and When Should It Be Used?</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Wed, 02 Jul 2025 02:43:58 +0000</pubDate>
      <link>https://dev.to/626tech/what-is-the-useref-hook-in-react-and-when-should-it-be-used-j3o</link>
      <guid>https://dev.to/626tech/what-is-the-useref-hook-in-react-and-when-should-it-be-used-j3o</guid>
      <description>&lt;h3&gt;
  
  
  SCOPE
&lt;/h3&gt;

&lt;p&gt;A React Hook is a special function in React that lets developers use state and other React features without writing a class. It makes code simpler and easier to manage by allowing functionality to be added directly within components.Now we will discuss the &lt;code&gt;useRef&lt;/code&gt; Hook in the following sections:&lt;/p&gt;




&lt;h3&gt;
  
  
  📘 What is the &lt;code&gt;useRef&lt;/code&gt; Hook in React and When Should It Be Used?
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1.Introduction to useRef&lt;br&gt;
2.Syntax of useRef&lt;br&gt;
Common Use Cases&lt;br&gt;
3.1. Accessing DOM Elements&lt;br&gt;
3.2. Storing Mutable Values&lt;br&gt;
3.3. Persisting Values Without Re-render&lt;br&gt;
Example Use Cases&lt;br&gt;
4.1. Focus an Input Field&lt;br&gt;
4.2. Keep Track of Previous State&lt;br&gt;
4.3. Interval with Mutable Reference&lt;br&gt;
5.Best Practices&lt;br&gt;
6.Conclusion&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;Introduction to &lt;code&gt;useRef&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;


&lt;p&gt;&lt;code&gt;useRef&lt;/code&gt; is a built-in React hook that returns a mutable ref object. It is primarily used to reference DOM elements or persist values across renders without triggering a re-render.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const myRef = useRef(initialValue);&lt;/code&gt;&lt;br&gt;
The returned object:&lt;br&gt;
&lt;code&gt;{ current: initialValue }&lt;/code&gt;&lt;br&gt;
This object is mutable and persists for the lifetime of the component.&lt;/p&gt;




&lt;h2&gt;
  
  
  2.Syntax of &lt;code&gt;useRef&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Here's how you import and use it:&lt;br&gt;
&lt;code&gt;import { useRef } from 'react';&lt;/code&gt;&lt;br&gt;
&lt;code&gt;function MyComponent() {&lt;br&gt;
  const inputRef = useRef(null);&lt;br&gt;
return &amp;lt;input ref={inputRef} /&amp;gt;;&lt;/code&gt;&lt;br&gt;
}&lt;br&gt;
You access or modify the ref with:&lt;br&gt;
&lt;code&gt;inputRef.current&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3.Common Use Cases
&lt;/h2&gt;

&lt;h4&gt;
  
  
  3.1.Accessing DOM Elements
&lt;/h4&gt;

&lt;p&gt;You can use useRef to directly access or manipulate a DOM element, such as focusing an input field or reading values without event handlers.&lt;/p&gt;

&lt;h4&gt;
  
  
  3.2.Storing Mutable Values
&lt;/h4&gt;

&lt;p&gt;It can hold any mutable value (like a counter or timeout ID) that shouldn't cause a re-render when updated.&lt;/p&gt;

&lt;h4&gt;
  
  
  3.3.Persisting Values Without Re-render
&lt;/h4&gt;

&lt;p&gt;Unlike useState, changing the .current property of a ref does not trigger a re-render, making it ideal for tracking non-UI-changing values.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example Use Cases
&lt;/h2&gt;

&lt;h4&gt;
  
  
  4.1.Focus an Input Field
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;import React, { useRef } from 'react';&lt;br&gt;
function FocusInput() {&lt;br&gt;
  const inputRef = useRef(null);&lt;br&gt;
  const handleClick = () =&amp;gt; {&lt;br&gt;
    inputRef.current.focus();&lt;br&gt;
  };&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;&amp;gt;&lt;br&gt;
      &amp;lt;input ref={inputRef} type="text" /&amp;gt;&lt;br&gt;
      &amp;lt;button onClick={handleClick}&amp;gt;Focus Input&amp;lt;/button&amp;gt;&lt;br&gt;
    &amp;lt;/&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  4.2.Keep Track of Previous State
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;import React, { useEffect, useRef, useState } from 'react';&lt;br&gt;
function PreviousValueExample() {&lt;br&gt;
  const [count, setCount] = useState(0);&lt;br&gt;
  const prevCountRef = useRef();&lt;br&gt;
  useEffect(() =&amp;gt; {&lt;br&gt;
    prevCountRef.current = count;&lt;br&gt;
  });&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;p&amp;gt;Current: {count}&amp;lt;/p&amp;gt;&lt;br&gt;
      &amp;lt;p&amp;gt;Previous: {prevCountRef.current}&amp;lt;/p&amp;gt;&lt;br&gt;
      &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;Increment&amp;lt;/button&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  4.3.Interval with Mutable Reference
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;import React, { useRef, useEffect, useState } from 'react';&lt;br&gt;
function Timer() {&lt;br&gt;
  const [seconds, setSeconds] = useState(0);&lt;br&gt;
  const intervalRef = useRef(null);&lt;br&gt;
  useEffect(() =&amp;gt; {&lt;br&gt;
    intervalRef.current = setInterval(() =&amp;gt; {&lt;br&gt;
      setSeconds(prev =&amp;gt; prev + 1);&lt;br&gt;
    }, 1000);&lt;br&gt;
    return () =&amp;gt; clearInterval(intervalRef.current);&lt;br&gt;
  }, []);&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;p&amp;gt;Timer: {seconds}s&amp;lt;/p&amp;gt;&lt;br&gt;
      &amp;lt;button onClick={() =&amp;gt; clearInterval(intervalRef.current)}&amp;gt;Stop&amp;lt;/button&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  5.Best Practices
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;✅ Use useRef for non-rendering values or DOM access.&lt;/li&gt;
&lt;li&gt;❌ Avoid using &lt;code&gt;useRef&lt;/code&gt; to replace all &lt;code&gt;useState&lt;/code&gt; — they serve different purposes.&lt;/li&gt;
&lt;li&gt;✅ Use &lt;code&gt;useRef&lt;/code&gt; to store mutable variables like timers, counters, or previous props/state.&lt;/li&gt;
&lt;li&gt;❌ Don’t use &lt;code&gt;useRef&lt;/code&gt; to track values that should appear in the UI without forcing updates manually.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  6.Summary
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;useRef&lt;/code&gt; hook is a powerful tool in React for handling references to DOM elements and persisting mutable data across renders without causing re-renders. It's an essential hook for performance optimization, direct DOM access, and managing non-reactive values.&lt;br&gt;
Use it wisely alongside &lt;code&gt;useState&lt;/code&gt; and &lt;code&gt;useEffect&lt;/code&gt; to build efficient, interactive React components.&lt;br&gt;
&lt;em&gt;questions are welcomed in the comment box.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to capture a camera's input on a mobile device using &lt;input&gt; element</title>
      <dc:creator> Tijani Olagunju</dc:creator>
      <pubDate>Tue, 01 Jul 2025 11:32:20 +0000</pubDate>
      <link>https://dev.to/626tech/how-to-capture-a-cameras-input-on-a-mobile-device-using-element-2c5m</link>
      <guid>https://dev.to/626tech/how-to-capture-a-cameras-input-on-a-mobile-device-using-element-2c5m</guid>
      <description>&lt;p&gt;This guide explains the steps to capture a user's camera on a mobile device. Although this guide is focused mainly on &lt;code&gt;HTML&lt;/code&gt;, I added a tip on how to preview captured image using &lt;code&gt;JavaScript&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHILOSOPHY&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modern mobile browsers allow web developers to access the device's camera using a simple &lt;code&gt;&amp;lt;input type="file"&amp;gt;&lt;/code&gt; element with some special attributes. I explain how to implement this feature for capturing photos or videos from the user’s camera directly via a mobile device below&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BASIC SYNTAX&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;input type="file" accept="image/*" capture&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BELOW IS A MORE DETAILED LIST ABOUT THE ATTRIBUTES:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;type="file"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This makes the input element a file picker.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;accept="image/*" or accept="video/*"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Tells the browser to restrict selectable file types.&lt;/p&gt;

&lt;p&gt;Common values&lt;br&gt;
    &lt;code&gt;image/* — Opens camera for photos.&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;video/* — Opens camera for videos.&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;image/*,video/* — Allows choosing both types.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;capture (&lt;em&gt;attribute with or without value&lt;/em&gt;)&lt;/p&gt;

&lt;p&gt;This hints to the browser to open the camera app instead of the gallery.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Front Camera and Rear Camera Options:&lt;/em&gt;&lt;br&gt;
&lt;code&gt;capture="user"   &amp;lt;!-- Front camera (selfie) --&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;capture="environment" &amp;lt;!-- Rear camera --&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;capture           &amp;lt;!-- Defaults to available camera --&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THE NEXT LIST CONSIST OF GUIDELINES...&lt;/strong&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  1. To Capture a Photo
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;label for="cameraInput"&amp;gt;Take a photo:&amp;lt;/label&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;input type="file" id="cameraInput" accept="image/*" capture="environment"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  2. To Capture a Video
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;label for="videoInput"&amp;gt;Record a video:&amp;lt;/label&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;input type="file" id="videoInput" accept="video/*" capture&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  3. To Capture Either Photo or Video
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;label for="mediaInput"&amp;gt;Capture photo or video:&amp;lt;/label&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;input type="file" id="mediaInput" accept="image/*,video/*" capture&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;&lt;br&gt;
Desktop browsers usually ignore the capture attribute.While some modern browsers support video capture, others may only support image capture. The device capabilities determines if the capture attribute support video or image capture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PRIVACY CONSIDERATION&lt;/strong&gt;&lt;br&gt;
The browser asks for permission before accessing the camera.&lt;br&gt;
Files are not uploaded automatically — you need to handle that via &lt;code&gt;JavaScript&lt;/code&gt; or form submission.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ensure to do the following:&lt;/strong&gt;&lt;br&gt;
*Always provide fallback instructions for users.&lt;br&gt;
*Use CSS to style the  for a better mobile experience.&lt;br&gt;
*Hide the input and trigger it with a button for a custom UI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TIP TO PREVIEW CAPTURED IMAGE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;input type="file" id="cameraInput" accept="image/*" capture&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;img id="preview" style="max-width: 100%; margin-top: 10px;" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script&amp;gt;&lt;br&gt;
  document.getElementById("cameraInput").addEventListener("change", function(event) {&lt;br&gt;
    const file = event.target.files[0];&lt;br&gt;
    if (file) {&lt;br&gt;
      const preview = document.getElementById("preview");&lt;br&gt;
      preview.src = URL.createObjectURL(file);&lt;br&gt;
    }&lt;br&gt;
  });&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;KEYPOINT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The HTML &lt;code&gt;&amp;lt;input type="file"&amp;gt;&lt;/code&gt; element with the capture attribute is a powerful, easy-to-implement way to open the mobile device’s camera for capturing images or videos. While it doesn’t provide deep camera control (like WebRTC does), it’s perfect for simple use cases like uploading profile pictures, document scans, or video messages.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This brings us to the end of this Manual.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
