<?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: Sachin</title>
    <description>The latest articles on DEV Community by Sachin (@sachin_25f3442b5b2880f1ec).</description>
    <link>https://dev.to/sachin_25f3442b5b2880f1ec</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%2F2609322%2F46bedc37-a029-4a8d-8fc6-50c33fabe71d.png</url>
      <title>DEV Community: Sachin</title>
      <link>https://dev.to/sachin_25f3442b5b2880f1ec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sachin_25f3442b5b2880f1ec"/>
    <language>en</language>
    <item>
      <title>Connecting frontend And Backend In react.js</title>
      <dc:creator>Sachin</dc:creator>
      <pubDate>Sat, 04 Jan 2025 09:42:14 +0000</pubDate>
      <link>https://dev.to/sachin_25f3442b5b2880f1ec/connecting-frontend-and-backend-in-reactjs-1edk</link>
      <guid>https://dev.to/sachin_25f3442b5b2880f1ec/connecting-frontend-and-backend-in-reactjs-1edk</guid>
      <description>&lt;p&gt;Connecting React.js Frontend to Backend&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create a fresh folder
run the command in the folder directory:-
npm create vite@latest
cd to the given project-name
and run npm install
&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;import { useState ,useEffect } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import axios from 'axios'
function App() {
   const [data,setData]=useState({});

   useEffect(()=&amp;gt;{
     const fetchData=async ()=&amp;gt;{
        const result=await axios.get("https://jsonplaceholder.typicode.com/posts/1");
        setData(result.data);
     }

     fetchData()
   },[])

   return &amp;lt;div&amp;gt;
     {data ? JSON.stringify(data) : "Loading..."}
   &amp;lt;/div&amp;gt;
}

export default App

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

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>Dark Mode In React (vite)</title>
      <dc:creator>Sachin</dc:creator>
      <pubDate>Tue, 24 Dec 2024 15:28:38 +0000</pubDate>
      <link>https://dev.to/sachin_25f3442b5b2880f1ec/dark-mode-in-react-vite-31ln</link>
      <guid>https://dev.to/sachin_25f3442b5b2880f1ec/dark-mode-in-react-vite-31ln</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**create a fresh folder
run the commands npm create vite@latest (in the folder directory)
also cd to the directory and run the command npm install**
&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;step 1
`Code in App.jsx`
import React, { useState } from 'react';
import { FaSun, FaMoon } from 'react-icons/fa'; // Import Sun and Moon icons
import './App.css';

function App() {
  const [darkMode, setDarkMode] = useState(false);

  // Toggle dark mode
  const toggleTheme = () =&amp;gt; {
    setDarkMode(!darkMode);
  };

  return (
    &amp;lt;div className={darkMode ? 'dark' : 'light'}&amp;gt;
      &amp;lt;div className="container"&amp;gt;
        &amp;lt;h1&amp;gt;{darkMode ? 'Dark Mode' : 'Light Mode'}&amp;lt;/h1&amp;gt;
        &amp;lt;button className="toggle-button" onClick={toggleTheme}&amp;gt;
          {darkMode ? &amp;lt;FaMoon className="icon" /&amp;gt; : &amp;lt;FaSun className="icon" /&amp;gt;}
          {darkMode ? ' Dark Mode' : ' Light Mode'}
        &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;

&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;Code in App.css
`body {
    margin: 0;
    font-family: Arial, sans-serif;
  }

  .container {
    text-align: center;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  /* Light Mode Styles */
  .light {
    background-color: #f9f9f9;
    color: #333;
  }

  /* Dark Mode Styles */
  .dark {
    background-color: #333;
    color: #f9f9f9;
  }

  /* Toggle Button Styles */
  .toggle-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    background-color: #007bff;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
  }

  .toggle-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
  }

  .icon {
    font-size: 20px;
  }`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Final Output &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zzsgi18ajpkfqw7ihl6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zzsgi18ajpkfqw7ihl6.png" alt="Image description" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>css</category>
    </item>
  </channel>
</rss>
