<?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: swetha palani</title>
    <description>The latest articles on DEV Community by swetha palani (@swetha_palani_1547914a082).</description>
    <link>https://dev.to/swetha_palani_1547914a082</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%2F3375097%2Ffe7e231b-ee03-4f96-baf8-3b6e4c2e17f1.jpeg</url>
      <title>DEV Community: swetha palani</title>
      <link>https://dev.to/swetha_palani_1547914a082</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/swetha_palani_1547914a082"/>
    <language>en</language>
    <item>
      <title>Java Architecture</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 24 Oct 2025 04:48:55 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/java-architecture-174d</link>
      <guid>https://dev.to/swetha_palani_1547914a082/java-architecture-174d</guid>
      <description>&lt;p&gt;Java Architecture defines how the &lt;strong&gt;Java programming language&lt;/strong&gt; works internally — from writing code to running it on any device.&lt;br&gt;
It explains how Java achieves its famous feature:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Write Once, Run Anywhere” (WORA)&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Main Components of Java Architecture&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Java Architecture mainly consists of &lt;strong&gt;three key parts&lt;/strong&gt;:&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;A. Java Virtual Machine (JVM)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;JVM is the &lt;strong&gt;engine&lt;/strong&gt; that runs Java programs.&lt;/li&gt;
&lt;li&gt;It converts &lt;strong&gt;bytecode&lt;/strong&gt; (intermediate code) into &lt;strong&gt;machine code&lt;/strong&gt; for the current operating system.&lt;/li&gt;
&lt;li&gt;It makes Java platform-independent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Functions of JVM:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loads code&lt;/li&gt;
&lt;li&gt;Verifies code&lt;/li&gt;
&lt;li&gt;Executes code&lt;/li&gt;
&lt;li&gt;Manages memory (Garbage Collection)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;B. Java Runtime Environment (JRE)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;JRE = JVM + Libraries + Other components to run applications.&lt;/li&gt;
&lt;li&gt;It provides all the &lt;strong&gt;necessary runtime environments&lt;/strong&gt; for Java programs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Think of JRE as:&lt;/strong&gt;&lt;br&gt;
The setup needed to &lt;strong&gt;run&lt;/strong&gt; a Java program (but not to develop one).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;C. Java Development Kit (JDK)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;JDK = JRE + Development tools.&lt;/li&gt;
&lt;li&gt;It’s used by developers to &lt;strong&gt;write&lt;/strong&gt;, &lt;strong&gt;compile&lt;/strong&gt;, and &lt;strong&gt;run&lt;/strong&gt; Java programs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Includes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiler (&lt;code&gt;javac&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Debugger&lt;/li&gt;
&lt;li&gt;JavaDoc tool&lt;/li&gt;
&lt;li&gt;JRE&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Think of JDK as:&lt;/strong&gt;&lt;br&gt;
The &lt;strong&gt;complete toolkit&lt;/strong&gt; for Java developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Flow of Execution in Java&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Here’s how a Java program runs step-by-step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;You write code&lt;/strong&gt; → &lt;code&gt;MyProgram.java&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compiler (&lt;code&gt;javac&lt;/code&gt;)&lt;/strong&gt; → converts code to &lt;strong&gt;Bytecode&lt;/strong&gt; → &lt;code&gt;MyProgram.class&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classloader&lt;/strong&gt; → loads &lt;code&gt;.class&lt;/code&gt; files into JVM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bytecode Verifier&lt;/strong&gt; → checks code safety&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JIT Compiler (Just-In-Time)&lt;/strong&gt; → converts bytecode to native machine code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JVM executes&lt;/strong&gt; the program&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;4. Diagram: Java Architecture&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          ┌──────────────────────────────┐
          │       Java Application       │
          └──────────────┬───────────────┘
                         │
                (1) Compiled by javac
                         │
          ┌──────────────▼───────────────┐
          │        Bytecode (.class)     │
          └──────────────┬───────────────┘
                         │
                (2) Loaded by Classloader
                         │
          ┌──────────────▼───────────────┐
          │             JVM              │
          │  ┌────────────────────────┐  │
          │  │ Class Loader Subsystem │  │
          │  │ Bytecode Verifier      │  │
          │  │ Interpreter/JIT        │  │
          │  │ Garbage Collector      │  │
          │  └────────────────────────┘  │
          └──────────────┬───────────────┘
                         │
               (3) Machine Code Executed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>programming</category>
      <category>code</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Logical probelms</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 10 Oct 2025 06:49:35 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/zoho-prepartion-1d32</link>
      <guid>https://dev.to/swetha_palani_1547914a082/zoho-prepartion-1d32</guid>
      <description>&lt;h2&gt;
  
  
  🧠 &lt;strong&gt;50 Python Logical Coding Questions (Zoho-Style)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;(Focus on loops, strings, arrays, logic, and real test patterns)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 Basic Level (1–15)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Print numbers from 1 to 100 without using loops.&lt;/li&gt;
&lt;li&gt;Print the Fibonacci series up to n terms.&lt;/li&gt;
&lt;li&gt;Find the factorial of a given number.&lt;/li&gt;
&lt;li&gt;Check if a number is prime.&lt;/li&gt;
&lt;li&gt;Reverse a number using while loop.&lt;/li&gt;
&lt;li&gt;Check if a string is a palindrome.&lt;/li&gt;
&lt;li&gt;Count vowels and consonants in a string.&lt;/li&gt;
&lt;li&gt;Find the sum of digits of a number.&lt;/li&gt;
&lt;li&gt;Swap two numbers without using a third variable.&lt;/li&gt;
&lt;li&gt;Print all even numbers in a given range.&lt;/li&gt;
&lt;li&gt;Print multiplication table of a given number.&lt;/li&gt;
&lt;li&gt;Find the greatest of three numbers using if-else.&lt;/li&gt;
&lt;li&gt;Check if a number is an Armstrong number.&lt;/li&gt;
&lt;li&gt;Print all prime numbers between 1 to 100.&lt;/li&gt;
&lt;li&gt;Find the average of numbers in a list.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  🔹 Intermediate Level (16–35)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Find 2nd largest element in a list.&lt;/li&gt;
&lt;li&gt;Remove duplicates from a list.&lt;/li&gt;
&lt;li&gt;Sort a list without using &lt;code&gt;sort()&lt;/code&gt; or &lt;code&gt;sorted()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Find common elements between two lists.&lt;/li&gt;
&lt;li&gt;Count frequency of elements in a list.&lt;/li&gt;
&lt;li&gt;Merge two sorted lists.&lt;/li&gt;
&lt;li&gt;Reverse a string without using slicing.&lt;/li&gt;
&lt;li&gt;Check if two strings are anagrams.&lt;/li&gt;
&lt;li&gt;Count words in a given sentence.&lt;/li&gt;
&lt;li&gt;Find character frequency in a string.&lt;/li&gt;
&lt;li&gt;Replace all vowels in a string with &lt;code&gt;*&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Remove special characters from a string.&lt;/li&gt;
&lt;li&gt;Find missing number in 1 to n series.&lt;/li&gt;
&lt;li&gt;Find sum of even and odd numbers in a list.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Print pattern:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*
**
***
****
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Print pattern:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
12
123
1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Print pattern:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A
BB
CCC
DDDD
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find the intersection and union of two sets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Count capital and small letters in a string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Print all unique elements in a list.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  🔹 Advanced / Zoho Test Level (36–50)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Implement a program to check for balanced parentheses.&lt;/li&gt;
&lt;li&gt;Find all pairs in a list whose sum equals a given number.&lt;/li&gt;
&lt;li&gt;Rotate array elements to left/right by k steps.&lt;/li&gt;
&lt;li&gt;Implement a simple calculator using functions.&lt;/li&gt;
&lt;li&gt;Find the longest word in a given sentence.&lt;/li&gt;
&lt;li&gt;Convert string &lt;code&gt;"a3b2c1"&lt;/code&gt; → &lt;code&gt;"aaabbc"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Convert a decimal number to binary manually.&lt;/li&gt;
&lt;li&gt;Print frequency of each word in a paragraph.&lt;/li&gt;
&lt;li&gt;Reverse words in a sentence but not characters.&lt;/li&gt;
&lt;li&gt;Find the first non-repeating character in a string.&lt;/li&gt;
&lt;li&gt;Remove duplicates from string while maintaining order.&lt;/li&gt;
&lt;li&gt;Find if a number is “strong number” (sum of factorial of digits = number).&lt;/li&gt;
&lt;li&gt;Find sum of all prime digits in a number.&lt;/li&gt;
&lt;li&gt;Find maximum occurring character in a string.&lt;/li&gt;
&lt;li&gt;Given matrix → print its transpose.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  📘 &lt;strong&gt;50 Aptitude &amp;amp; Reasoning Practice Questions (Zoho-Style)&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔹 Quantitative Aptitude (1–25)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A train 120 m long passes a man walking at 6 km/hr in 10 sec. Find train speed.&lt;/li&gt;
&lt;li&gt;The ratio of ages of A and B is 3:5. After 10 years, ratio becomes 4:6. Find their present ages.&lt;/li&gt;
&lt;li&gt;If the cost price is ₹800 and gain is 20%, find selling price.&lt;/li&gt;
&lt;li&gt;A can do a work in 10 days, B in 15 days. How long will they take together?&lt;/li&gt;
&lt;li&gt;A person spends 40% on rent, 30% on food, saves ₹600. Find income.&lt;/li&gt;
&lt;li&gt;Find the simple interest on ₹5000 at 8% per annum for 2 years.&lt;/li&gt;
&lt;li&gt;Find compound interest on ₹4000 for 2 years at 10%.&lt;/li&gt;
&lt;li&gt;Ratio of milk to water is 3:2. Add 10L water → new ratio 3:4. Find milk quantity.&lt;/li&gt;
&lt;li&gt;Two pipes fill a tank in 12 and 15 mins. Together?&lt;/li&gt;
&lt;li&gt;Speed of boat in still water = 10 km/hr, current = 3 km/hr. Find upstream speed.&lt;/li&gt;
&lt;li&gt;If 20 men complete a work in 15 days, 10 men do it in how many days?&lt;/li&gt;
&lt;li&gt;Selling price = ₹660, cost = ₹600. Find profit %.&lt;/li&gt;
&lt;li&gt;A can finish a job in 12 days, B can do same in 8 days. Find ratio of their efficiency.&lt;/li&gt;
&lt;li&gt;Find average of 23, 27, 31, 35, 39.&lt;/li&gt;
&lt;li&gt;If 30% of x = 45, find x.&lt;/li&gt;
&lt;li&gt;A car travels 120 km at 60 km/h. Time taken?&lt;/li&gt;
&lt;li&gt;A number is increased by 20% and then decreased by 10%. Find net % change.&lt;/li&gt;
&lt;li&gt;Find least number divisible by 8, 12, 15.&lt;/li&gt;
&lt;li&gt;A man buys 10 pens at ₹15 each and sells them for ₹180 total. Find gain %.&lt;/li&gt;
&lt;li&gt;The sum of first 20 natural numbers = ?&lt;/li&gt;
&lt;li&gt;Two numbers are in ratio 4:5. Their LCM = 180. Find numbers.&lt;/li&gt;
&lt;li&gt;Find the perimeter of a rectangle with l=12, b=8.&lt;/li&gt;
&lt;li&gt;A can do 1/3 of work in 5 days. Whole work in?&lt;/li&gt;
&lt;li&gt;Find HCF of 36 and 84.&lt;/li&gt;
&lt;li&gt;20% of a number is 50. Find the number.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  🔹 Logical Reasoning &amp;amp; Puzzles (26–50)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Arrange order:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Ramesh taller than Suresh&lt;/li&gt;
&lt;li&gt;Mahesh shorter than Ramesh&lt;/li&gt;
&lt;li&gt;Who is tallest?&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;If CAT = 3120, DOG = 4157 → BAT = ?&lt;/li&gt;
&lt;li&gt;Series: 2, 6, 12, 20, 30, ?&lt;/li&gt;
&lt;li&gt;Find the odd one: 3, 5, 7, 9, 11&lt;/li&gt;
&lt;li&gt;If + means ×, − means ÷, × means −, ÷ means +, find: 6 + 3 × 2 − 4 ÷ 2&lt;/li&gt;
&lt;li&gt;Arrange words in dictionary order: Mango, Apple, Orange, Banana&lt;/li&gt;
&lt;li&gt;If 3x + 7 = 16, find x.&lt;/li&gt;
&lt;li&gt;Fill series: A1, B2, C3, D4, ?&lt;/li&gt;
&lt;li&gt;Which word can be made from “INFORMATION”?&lt;/li&gt;
&lt;li&gt;In a row, Ram is 7th from left and 10th from right. How many students total?&lt;/li&gt;
&lt;li&gt;3 persons A, B, C. A beats B, B beats C, C beats A. Who is best?&lt;/li&gt;
&lt;li&gt;If 9 = 81, 8 = 64, 7 = 49, then 6 = ?&lt;/li&gt;
&lt;li&gt;Statement: All dogs are animals. All cats are animals. Conclusion: ?&lt;/li&gt;
&lt;li&gt;Odd one out: Square, Rectangle, Triangle, Circle&lt;/li&gt;
&lt;li&gt;If North-East = 1, South-West = 3, North-West = ?, find logic.&lt;/li&gt;
&lt;li&gt;Missing number:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3 5 8  
2 4 6  
1 ? 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Mirror image of word “TEAM”?&lt;/li&gt;
&lt;li&gt;If today is Wednesday, what day will it be after 45 days?&lt;/li&gt;
&lt;li&gt;Rahul’s mother is sister of Rani’s father. How is Rahul related to Rani?&lt;/li&gt;
&lt;li&gt;Which number replaces the question mark:
4 → 16, 5 → 25, 6 → ?&lt;/li&gt;
&lt;li&gt;Spot the pattern: 1, 4, 9, 16, 25, ?&lt;/li&gt;
&lt;li&gt;Arrange logic: Q → S, R → T, then U → ?&lt;/li&gt;
&lt;li&gt;6 people sit in a circle. A is left of B, C is opposite D — who is right of A?&lt;/li&gt;
&lt;li&gt;If in a code, A = 2, B = 4, C = 6, then ACE = ?&lt;/li&gt;
&lt;li&gt;Find missing alphabet: AZ, BY, CX, ?&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Would you like me to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;📄 Send these 100 questions as a &lt;strong&gt;PDF file (Zoho Crash Pack)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;or 📚 Give &lt;strong&gt;answers + explanations&lt;/strong&gt; for all coding and aptitude questions (for practice review)?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Which do you want next, da — PDF or with answers?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>PROPS in React</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 10 Oct 2025 06:45:49 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/props-in-react-5451</link>
      <guid>https://dev.to/swetha_palani_1547914a082/props-in-react-5451</guid>
      <description>&lt;p&gt;Props (short for properties) are read-only data passed from a parent component to a child component.They help in reusing components and data sharing.&lt;/p&gt;

&lt;p&gt;Props are arguments passed into React components, Props are passed to components via HTML attributes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXAMPLE:&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;**parent class(app.jsx)**

function App(){
return(
&amp;lt;Welcome 
name="swetha"
/&amp;gt;
)
}

**child class(Welcome.jsx)**

function Welcome(props){
return(
&amp;lt;div&amp;gt;
&amp;lt;h1&amp;gt;HELLO{props.name}&amp;lt;/h1&amp;gt;

);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT&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;HELLO swetha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why are props used in React?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pass data from parent to child component, Make components dynamic and reusable, Maintain one-way data flow&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can you modify props inside a component?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Props are immutable (cannot be changed).&lt;br&gt;
If you try to modify them, React will throw a warning or behave unexpectedly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to pass multiple props to a component?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can pass multiple props as key-value pairs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;App.jsx


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Are props read-only or mutable?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Props are read-only.&lt;br&gt;
You cannot modify props inside the child component.&lt;br&gt;
If data needs to change, use state instead&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens if a prop is not passed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a prop is missing, it will be undefined unless you use default props.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Components in react</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Thu, 09 Oct 2025 12:55:31 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/components-in-react-443d</link>
      <guid>https://dev.to/swetha_palani_1547914a082/components-in-react-443d</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;components come in two types, Class components and Function components&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If it react component can start captial Letter, all react component "JavaScript functions" but JavaScript functions not a react components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An react component to return HTML tags&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;TYPES OF COMPONENTS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Functional Components&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simple JavaScript functions that return JSX.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use React Hooks (useState, useEffect, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&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;function Hello(){
return (
&amp;lt;h1&amp;gt;React Components&amp;lt;/h1&amp;gt;
);
}
export default Hello;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Class components&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use ES6 classes and render() method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support lifecycle methods.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>useEffect in React</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Tue, 07 Oct 2025 05:13:07 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/useeffect-in-react-4h70</link>
      <guid>https://dev.to/swetha_palani_1547914a082/useeffect-in-react-4h70</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;What is &lt;code&gt;useEffect&lt;/code&gt;?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;useEffect&lt;/code&gt; is a &lt;strong&gt;React hook&lt;/strong&gt; that lets you perform &lt;strong&gt;side effects&lt;/strong&gt; in your components.&lt;br&gt;
Side effects are things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetching data from an API&lt;/li&gt;
&lt;li&gt;Updating the DOM manually&lt;/li&gt;
&lt;li&gt;Setting up a timer&lt;/li&gt;
&lt;li&gt;Logging data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It runs &lt;strong&gt;after the component renders&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;syntax&lt;/strong&gt; useEffect&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Syntax&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// code to run (side effect)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Runs &lt;strong&gt;after every render&lt;/strong&gt; by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Run only once (on mount)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// code to run once&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;ul&gt;
&lt;li&gt;Empty dependency array &lt;code&gt;[]&lt;/code&gt; → runs &lt;strong&gt;only when component mounts&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Run on specific state or prop change&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// code to run when `variable` changes&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;variable&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;variable&lt;/code&gt; → dependency, runs &lt;strong&gt;only when this changes&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Cleanup function (optional)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// setup code&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// cleanup code (like unsubscribing, clearing timers)&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="nx"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;When to use &lt;code&gt;useEffect&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;When you want something to happen &lt;strong&gt;after render&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;When you want to &lt;strong&gt;watch for changes&lt;/strong&gt; in a variable (state or props).&lt;/li&gt;
&lt;li&gt;When you want to &lt;strong&gt;clean up resources&lt;/strong&gt; (like timers, subscriptions) when a component unmounts.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Where to use&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Inside a &lt;strong&gt;functional component&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Simple Code Example&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Counter&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// useEffect runs after every render by default&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Count changed:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;count&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="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt; &lt;span class="c1"&gt;// dependency array&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increase&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Counter&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;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useEffect(() =&amp;gt; {...}, [count])&lt;/code&gt; → Runs &lt;strong&gt;only when &lt;code&gt;count&lt;/code&gt; changes&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Without &lt;code&gt;[count]&lt;/code&gt;, it runs &lt;strong&gt;after every render&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;[]&lt;/code&gt; (empty array), it runs &lt;strong&gt;only once when the component mounts&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




</description>
    </item>
    <item>
      <title>Useref in react theory question</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 03 Oct 2025 06:54:27 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/useref-in-react-theory-question-2m9e</link>
      <guid>https://dev.to/swetha_palani_1547914a082/useref-in-react-theory-question-2m9e</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;What is &lt;code&gt;useRef&lt;/code&gt; in React?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Answer: &lt;code&gt;useRef&lt;/code&gt; is a React hook that returns a mutable object (&lt;code&gt;.current&lt;/code&gt;) whose value persists across re-renders.&lt;/li&gt;
&lt;li&gt;Example: &lt;code&gt;const myRef = useRef(null);&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;What’s the difference between &lt;code&gt;useRef&lt;/code&gt; and &lt;code&gt;useState&lt;/code&gt;?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useState&lt;/code&gt; triggers re-renders when updated.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useRef&lt;/code&gt; does &lt;strong&gt;not&lt;/strong&gt; trigger re-renders when &lt;code&gt;.current&lt;/code&gt; changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;When should you use &lt;code&gt;useRef&lt;/code&gt; instead of &lt;code&gt;useState&lt;/code&gt;?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;When you want to store values that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don’t affect rendering.&lt;/li&gt;
&lt;li&gt;Should persist between renders (like timers, previous values, DOM references).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;How does &lt;code&gt;useRef&lt;/code&gt; help in accessing the DOM?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useRef&lt;/code&gt; stores a reference to a DOM element that you can access directly.&lt;/li&gt;
&lt;li&gt;Example: &lt;code&gt;myRef.current.focus()&lt;/code&gt; to focus an input.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;What happens if you update a &lt;code&gt;useRef&lt;/code&gt; value? Does the component re-render?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;No. Updating &lt;code&gt;.current&lt;/code&gt; does &lt;strong&gt;not&lt;/strong&gt; cause re-render.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Difference between &lt;code&gt;useRef&lt;/code&gt; and &lt;code&gt;createRef&lt;/code&gt;?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;createRef&lt;/code&gt; is re-created on each render (used in class components).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useRef&lt;/code&gt; persists the same object between renders.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Can &lt;code&gt;useRef&lt;/code&gt; be used to store previous state values?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Yes, by manually updating &lt;code&gt;.current&lt;/code&gt; inside &lt;code&gt;useEffect&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Can you pass &lt;code&gt;useRef&lt;/code&gt; between components?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Yes, but usually with &lt;code&gt;forwardRef&lt;/code&gt; to expose refs from child to parent.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;What is the initial value of a &lt;code&gt;useRef&lt;/code&gt; object?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Whatever you pass inside &lt;code&gt;useRef(initialValue)&lt;/code&gt; → stored in &lt;code&gt;.current&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Why is &lt;code&gt;useRef&lt;/code&gt; called a “box” object in React docs?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* Because `.current` acts like a box where you put a value and retrieve it without triggering re-renders.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Useref in react interview question</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 03 Oct 2025 06:50:57 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/useref-in-react-interview-question-4pn6</link>
      <guid>https://dev.to/swetha_palani_1547914a082/useref-in-react-interview-question-4pn6</guid>
      <description>&lt;p&gt;1.What is useRef in React?&lt;/p&gt;

&lt;p&gt;Answer: useRef is a React hook that returns a mutable object (.current) whose value persists across re-renders.&lt;/p&gt;

&lt;p&gt;Example: const myRef = useRef(null);&lt;/p&gt;

&lt;p&gt;2.What’s the difference between useRef and useState?&lt;/p&gt;

&lt;p&gt;useState triggers re-renders when updated.&lt;/p&gt;

&lt;p&gt;useRef does not trigger re-renders when .current changes.&lt;/p&gt;

&lt;p&gt;3.When should you use useRef instead of useState?&lt;/p&gt;

&lt;p&gt;When you want to store values that:&lt;/p&gt;

&lt;p&gt;Don’t affect rendering.&lt;/p&gt;

&lt;p&gt;Should persist between renders (like timers, previous values, DOM references).&lt;/p&gt;

&lt;p&gt;4.How does useRef help in accessing the DOM?&lt;/p&gt;

&lt;p&gt;useRef stores a reference to a DOM element that you can access directly.&lt;/p&gt;

&lt;p&gt;Example: myRef.current.focus() to focus an input.&lt;/p&gt;

&lt;p&gt;5.What happens if you update a useRef value? Does the component re-render?&lt;/p&gt;

&lt;p&gt;No. Updating .current does not cause re-render.&lt;/p&gt;

&lt;p&gt;6.Difference between useRef and createRef?&lt;/p&gt;

&lt;p&gt;createRef is re-created on each render (used in class components).&lt;/p&gt;

&lt;p&gt;useRef persists the same object between renders.&lt;/p&gt;

&lt;p&gt;7.Can useRef be used to store previous state values?&lt;/p&gt;

&lt;p&gt;Yes, by manually updating .current inside useEffect.&lt;/p&gt;

&lt;p&gt;8.Can you pass useRef between components?&lt;/p&gt;

&lt;p&gt;Yes, but usually with forwardRef to expose refs from child to parent.&lt;/p&gt;

&lt;p&gt;9.What is the initial value of a useRef object?&lt;/p&gt;

&lt;p&gt;Whatever you pass inside useRef(initialValue) → stored in .current.&lt;/p&gt;

&lt;p&gt;10.Why is useRef called a “box” object in React docs?&lt;/p&gt;

&lt;p&gt;Because .current acts like a box where you put a value and retrieve it without triggering re-renders.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>CODEONJVM for JavaCraft</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Tue, 30 Sep 2025 06:04:20 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/codeonjvm-for-javacraft-35ia</link>
      <guid>https://dev.to/swetha_palani_1547914a082/codeonjvm-for-javacraft-35ia</guid>
      <description>&lt;p&gt;✨ Had an incredible learning experience today at JavaCraft: Coding Possibilities, hosted by Code on JVM Chennai at Entrans Inc. Technologies Private Limited, Chennai 🚀☕&lt;br&gt;
The workshop was a perfect blend of knowledge, hands-on practice, and insights from industry professionals:&lt;br&gt;
🔹 Sri Santhosh Natarajan (Senior Software Engineer, Pearson India) – Reactive Java 101&lt;br&gt;
 We delved into moving from blocking to non-blocking APIs, exploring Spring WebFlux, FastAPI, and databases like MongoDB &amp;amp; PostgreSQL. The session offered a clear understanding of building scalable, reactive applications ⚡.&lt;br&gt;
🔹 Yagapriyan G (Software Engineer II, Arcadia) – JDBC Made Easy with PL/SQL&lt;br&gt;
 An in-depth session on JDBC connectivity and database operations, explained with practical examples and real-time scenarios 🔗.&lt;br&gt;
Both sessions were highly interactive and beginner-friendly, making it easy to grasp not just how things work, but also why they work that way 🙌.&lt;br&gt;
A huge thank you to the organizers for providing such an amazing platform for developers to learn, connect, and grow! 💻✨&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JSON in react</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 26 Sep 2025 09:49:52 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/json-in-react-3ik1</link>
      <guid>https://dev.to/swetha_palani_1547914a082/json-in-react-3ik1</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;What is JSON?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;JSON&lt;/strong&gt; stands for &lt;strong&gt;JavaScript Object Notation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It is a &lt;strong&gt;lightweight data format&lt;/strong&gt; used for &lt;strong&gt;storing and exchanging data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It looks like JavaScript objects, but it’s just &lt;strong&gt;text&lt;/strong&gt; (a string).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why JSON is used?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Easy to read and write (human-friendly).&lt;/li&gt;
&lt;li&gt;Easy for machines to parse and generate.&lt;/li&gt;
&lt;li&gt;Commonly used in &lt;strong&gt;APIs&lt;/strong&gt; to send data between a server and a client (like React, mobile apps, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Example of JSON&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Swetha"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"isStudent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"JavaScript"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"React"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Python"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just &lt;strong&gt;data in key-value pairs&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;JSON Rules&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Data is in &lt;strong&gt;key-value pairs&lt;/strong&gt; → &lt;code&gt;"key": "value"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Keys must be in &lt;strong&gt;double quotes&lt;/strong&gt; → &lt;code&gt;"name"&lt;/code&gt;, not &lt;code&gt;name&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Values can be:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;String → &lt;code&gt;"Swetha"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Number → &lt;code&gt;22&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Boolean → &lt;code&gt;true&lt;/code&gt; / &lt;code&gt;false&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Null → &lt;code&gt;null&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Array → &lt;code&gt;[1,2,3]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Object → &lt;code&gt;{ "city": "Chennai" }&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔹 &lt;strong&gt;JSON vs JavaScript Object&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;JSON:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Swetha"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;JS Object:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Swetha&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Difference: In JSON, keys &lt;strong&gt;must&lt;/strong&gt; be in double quotes, and it’s only text, not an actual object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In simple words:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;JSON is a text-based format to store and share data between different systems, especially in web development.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How JSON is used in React&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;backend/server&lt;/strong&gt; sends data in JSON format.&lt;/li&gt;
&lt;li&gt;React fetches it using &lt;code&gt;fetch()&lt;/code&gt; or &lt;code&gt;axios&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;JSON is converted into a &lt;strong&gt;JavaScript object&lt;/strong&gt; using &lt;code&gt;.json()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;React renders that data inside components.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step-by-step&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;fetch()&lt;/code&gt; → calls API.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.json()&lt;/code&gt; → parses JSON string into JS object.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setUsers(data)&lt;/code&gt; → saves data into state.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;map()&lt;/code&gt; → displays the data dynamically.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;Interview 1-Minute Answer&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“JSON is mainly used in React when fetching data from APIs. The server usually returns a JSON response, which we parse using &lt;code&gt;.json()&lt;/code&gt;. Then we store it in state and render it inside components using methods like &lt;code&gt;.map()&lt;/code&gt;.”&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
      <category>api</category>
    </item>
    <item>
      <title>Props types in raect</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 26 Sep 2025 09:20:13 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/props-types-in-raect-1ojb</link>
      <guid>https://dev.to/swetha_palani_1547914a082/props-types-in-raect-1ojb</guid>
      <description>&lt;p&gt;In &lt;strong&gt;React&lt;/strong&gt;, &lt;strong&gt;PropTypes&lt;/strong&gt; is a way to check the &lt;strong&gt;data types&lt;/strong&gt; of props that a component receives.&lt;br&gt;
It helps you catch bugs by warning you if the wrong type of data is passed to a component.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use PropTypes?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ensures components get the right type of data.&lt;/li&gt;
&lt;li&gt;Provides documentation for other developers.&lt;/li&gt;
&lt;li&gt;Helps in debugging unexpected prop values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to use &lt;code&gt;PropTypes&lt;/code&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Import &lt;code&gt;prop-types&lt;/code&gt; package:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;prop-types
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Example in a component:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PropTypes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prop-types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Name: &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Age: &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Student: &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isStudent&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Yes&lt;/span&gt;&lt;span class="dl"&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;No&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//  Setting PropTypes&lt;/span&gt;
&lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;propTypes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PropTypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isRequired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;// must be a string&lt;/span&gt;
  &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PropTypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;              &lt;span class="c1"&gt;// must be a number&lt;/span&gt;
  &lt;span class="na"&gt;isStudent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PropTypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bool&lt;/span&gt;           &lt;span class="c1"&gt;// must be true/false&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Default props&lt;/span&gt;
&lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;defaultProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;isStudent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common PropTypes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.string&lt;/code&gt; → string&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.number&lt;/code&gt; → number&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.bool&lt;/code&gt; → true/false&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.array&lt;/code&gt; → array&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.object&lt;/code&gt; → object&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.func&lt;/code&gt; → function&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.node&lt;/code&gt; → anything that can be rendered (elements, strings, numbers)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.element&lt;/code&gt; → React element&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.oneOf(["a", "b"])&lt;/code&gt; → one specific value&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.arrayOf(PropTypes.number)&lt;/code&gt; → array of numbers&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PropTypes.shape({ key: PropTypes.string })&lt;/code&gt; → object with specific structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;PropTypes vs TypeScript in React&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;PropTypes&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;TypeScript&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it is&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A separate &lt;strong&gt;library&lt;/strong&gt; (&lt;code&gt;prop-types&lt;/code&gt;) for runtime type checking&lt;/td&gt;
&lt;td&gt;A &lt;strong&gt;superset of JavaScript&lt;/strong&gt; that adds static typing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Type Checking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Happens at &lt;strong&gt;runtime&lt;/strong&gt; → shows warnings in the console when props are invalid&lt;/td&gt;
&lt;td&gt;Happens at &lt;strong&gt;compile-time&lt;/strong&gt; → errors before running the code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Only checks &lt;strong&gt;props&lt;/strong&gt; in React components&lt;/td&gt;
&lt;td&gt;Checks props + state + functions + variables + entire codebase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install prop-types&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install typescript&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ease of Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lightweight, simple, no extra setup&lt;/td&gt;
&lt;td&gt;More setup (tsconfig.json, type definitions)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Small projects, quick prop validation&lt;/td&gt;
&lt;td&gt;Large projects, full-scale type safety&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Interview-Friendly Answer (30 sec)&lt;/strong&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;“PropTypes is a library in React for runtime type checking of props, whereas TypeScript provides compile-time type safety for the entire codebase, not just props. PropTypes is simpler and useful in small projects, but TypeScript is preferred in modern large-scale applications because it prevents errors before running the code.”&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Function compound &amp; class compound in react</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Fri, 26 Sep 2025 04:51:05 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/function-compound-class-compound-in-react-33p0</link>
      <guid>https://dev.to/swetha_palani_1547914a082/function-compound-class-compound-in-react-33p0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Function Component in React&lt;/strong&gt;&lt;br&gt;
A &lt;strong&gt;function component&lt;/strong&gt; is a plain JavaScript function that returns JSX and can use React Hooks like &lt;code&gt;useState&lt;/code&gt; and &lt;code&gt;useEffect&lt;/code&gt; to manage state and lifecycle. It’s simpler and more efficient than class components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compound Component Pattern&lt;/strong&gt;&lt;br&gt;
The &lt;strong&gt;compound component pattern&lt;/strong&gt; lets multiple related components work together, sharing state via React context instead of passing many props. Example: Tabs with &lt;code&gt;Tab&lt;/code&gt;, &lt;code&gt;TabList&lt;/code&gt;, and &lt;code&gt;TabPanel&lt;/code&gt;. It provides a clean, flexible, and reusable API.&lt;/p&gt;

&lt;p&gt;Simple :&lt;br&gt;
“Function components are the modern way of building React components using hooks, and the compound component pattern helps create reusable, flexible UIs by allowing components to communicate implicitly.”&lt;/p&gt;

&lt;p&gt;Class components:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“A class component in React is an ES6 class that extends &lt;code&gt;React.Component&lt;/code&gt;. It must have a &lt;code&gt;render()&lt;/code&gt; method that returns JSX. Unlike function components, class components can manage state using &lt;code&gt;this.state&lt;/code&gt;, update it with &lt;code&gt;this.setState()&lt;/code&gt;, and use lifecycle methods like &lt;code&gt;componentDidMount&lt;/code&gt; and &lt;code&gt;componentWillUnmount&lt;/code&gt;. However, in modern React, class components are less common because function components with hooks provide the same features in a simpler way.”&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>USESTATE IN REACT</title>
      <dc:creator>swetha palani</dc:creator>
      <pubDate>Tue, 23 Sep 2025 05:44:36 +0000</pubDate>
      <link>https://dev.to/swetha_palani_1547914a082/usestate-in-react-2ih4</link>
      <guid>https://dev.to/swetha_palani_1547914a082/usestate-in-react-2ih4</guid>
      <description>&lt;ol&gt;
&lt;li&gt;What is useState?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;useState is a Hook in React, It allows functional components to have state (something only class components could do earlier with this.state).&lt;/p&gt;

&lt;p&gt;SYNTAX:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [state, setState] = useState(initialValue);

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;state → current value of the state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;setState → function to update the state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;initialValue → the value you want the state to start with.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright! Let’s make &lt;strong&gt;React Hook&lt;/strong&gt; super clear, especially from an &lt;strong&gt;interview perspective&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. What is a React Hook?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt; are special &lt;strong&gt;functions in React&lt;/strong&gt; that let you &lt;strong&gt;“hook into” React features&lt;/strong&gt; like state and lifecycle methods in &lt;strong&gt;functional components&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;They were introduced in &lt;strong&gt;React 16.8&lt;/strong&gt; to &lt;strong&gt;avoid using class components&lt;/strong&gt; for stateful logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key idea:&lt;/strong&gt; Hooks allow functional components to have &lt;strong&gt;state, side effects, and more&lt;/strong&gt; without writing a class.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Common React Hooks&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;useState&lt;/strong&gt; → for state management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useEffect&lt;/strong&gt; → for side effects like API calls, timers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useContext&lt;/strong&gt; → for consuming context&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useReducer&lt;/strong&gt; → for complex state management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useRef&lt;/strong&gt; → to access DOM elements or persist values&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Why Hooks? (Advantages)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No need for class components → simpler, cleaner code.&lt;/li&gt;
&lt;li&gt;Reuse stateful logic across components (&lt;strong&gt;custom hooks&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Better separation of concerns in components.&lt;/li&gt;
&lt;li&gt;Avoids confusion with &lt;code&gt;this&lt;/code&gt; keyword in classes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;4. Where to use Hooks?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Only inside functional components&lt;/strong&gt; or &lt;strong&gt;custom hooks&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not in loops, conditions, or nested functions&lt;/strong&gt; → must be top-level.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5. How to use a Hook?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Example with &lt;code&gt;useState&lt;/code&gt;:&lt;/strong&gt;&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Counter&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Hook usage&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&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;



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