<?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: Ijeoma </title>
    <description>The latest articles on DEV Community by Ijeoma  (@ijayyyy).</description>
    <link>https://dev.to/ijayyyy</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%2F1008297%2F19e8bba3-a3f2-43fd-9b34-12ab9d84e6bf.jpeg</url>
      <title>DEV Community: Ijeoma </title>
      <link>https://dev.to/ijayyyy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ijayyyy"/>
    <language>en</language>
    <item>
      <title>FOLLOWERS SPIKE IN 7 HOURS ON DEVTO</title>
      <dc:creator>Ijeoma </dc:creator>
      <pubDate>Thu, 04 Jul 2024 07:22:20 +0000</pubDate>
      <link>https://dev.to/ijayyyy/followers-spike-in-7-hours-on-devto-4465</link>
      <guid>https://dev.to/ijayyyy/followers-spike-in-7-hours-on-devto-4465</guid>
      <description>&lt;p&gt;I have been on devto for a year and few months, my followers are barely up to 10, I've also written just one post. At midnight, I made a post about a cors issue I was facing and how it was resolved, nothing spectacular or serious.&lt;/p&gt;

&lt;p&gt;I woke up this morning to make some edits to the post, I realized I gained over a 100 followers. I was excited and checked if my post got some traffic but nothing serious, less than 25 readers.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F767uz4z4rvvx5ex35j7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F767uz4z4rvvx5ex35j7y.png" alt="reader's summary" width="800" height="248"&gt;&lt;/a&gt;&lt;br&gt;
Don't get me wrong, I am happy with the followers but I'm just curious to know what happened. My followers are still rising. I checked last year's post stats and nothing much is going on too, just a surge in new followers. &lt;/p&gt;

&lt;p&gt;Is it a spam stuff? I do not have a very active following on any social media platform also . Or did someone influential repost a link to my post? haha. Please if you read this and have any idea why, kindly leave a comment&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>beginners</category>
      <category>devjournal</category>
      <category>webdev</category>
    </item>
    <item>
      <title>SOLVING CORS ERROR</title>
      <dc:creator>Ijeoma </dc:creator>
      <pubDate>Wed, 03 Jul 2024 23:25:36 +0000</pubDate>
      <link>https://dev.to/ijayyyy/solving-cors-error-25i9</link>
      <guid>https://dev.to/ijayyyy/solving-cors-error-25i9</guid>
      <description>&lt;p&gt;&lt;strong&gt;INTRODUCTION&lt;/strong&gt;&lt;br&gt;
As a Mass Communication graduate turned software developer, my coding journey has been filled with both challenges and rewards. This article will highlight the challenge I faced solving a server-side problem related to CORS (Cross-Origin Resource Sharing). I will briefly give the step-by-step approach I took to resolve this issue and ensure my application was running smoothly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THE PROBLEM&lt;/strong&gt;&lt;br&gt;
The issue I encountered was a CORS error when trying to sign up users through my application. I used React TypeScript for my project. The client side of my application was hosted on Netlify, while the server side was hosted on Render. Despite configuring CORS on the server side of my application, I kept receiving errors. Here is a breakdown of how I resolved this issue.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 1: Identifying the CORS Error.
When users attempted to sign up, the browser's console showed that the server was not properly handling CORS requests. It showed this error:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 2: Configuring CORS on the Server.&lt;br&gt;
I had to make sure the server was correctly configured to handle CORS requests.  I configured the server to allow requests from my client’s URL on Netlify.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Rebuilding and Redeploying the Server.&lt;br&gt;
After making changes to the server configuration, it was important to recompile the TypeScript files into JavaScript and redeploy the server.&lt;br&gt;
&lt;code&gt;tsc&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 4: Ensuring Proper Endpoints on the Client Side.&lt;br&gt;
On the client side, I updated the API endpoint to point to the correct URL. This was where the error was, I forgot to add "/api/" to my baseUrl.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 5: Verifying and Testing&lt;br&gt;
After deploying the changes, I tested the application to ensure that the CORS errors were resolved and that the signup and login worked as expected. This involved:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing the signup and login from the client application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensuring that the server received and processed the requests correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checking the browser console and server logs for any other errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Solving the CORS and deployment issue was a significant learning experience. The error I encountered may not look like much, but it took me hours to figure it out, lol. This points out the importance of proper server configuration and thorough testing. &lt;br&gt;
If you encounter similar issue, remember to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check and configure your server for CORS.&lt;/li&gt;
&lt;li&gt;Ensure your client-side API calls the correct endpoints.&lt;/li&gt;
&lt;li&gt;Test your application after making changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;HNG INTERNSHIP AND ME&lt;/strong&gt;&lt;br&gt;
I recently embarked on the HNG Internship, a very competitive program designed to bring out the best in software developers.&lt;br&gt;
The internship offers an amazing opportunity to collaborate with experienced mentors and meet other smart interns.&lt;br&gt;
Do check out the HNG Internship program, it is an incredible platform to start your career in tech! Use any of the links below:&lt;br&gt;
(&lt;a href="https://hng.tech/premium"&gt;https://hng.tech/premium&lt;/a&gt;)&lt;br&gt;
(&lt;a href="https://hng.tech/internship"&gt;https://hng.tech/internship&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>cors</category>
      <category>beginners</category>
      <category>typescript</category>
      <category>react</category>
    </item>
    <item>
      <title>A Simple React Counter with Input Value using React Hooks =&gt; UseState and UseReducer.</title>
      <dc:creator>Ijeoma </dc:creator>
      <pubDate>Sun, 15 Jan 2023 01:47:15 +0000</pubDate>
      <link>https://dev.to/ijayyyy/a-simple-react-counter-with-input-value-using-react-hooks-usestate-and-usereducer-4aog</link>
      <guid>https://dev.to/ijayyyy/a-simple-react-counter-with-input-value-using-react-hooks-usestate-and-usereducer-4aog</guid>
      <description>&lt;p&gt;Hello techie, In this post, you will learn two different ways to create a &lt;strong&gt;Counter App&lt;/strong&gt; with input value using two &lt;strong&gt;React Hooks: useState&lt;/strong&gt; and &lt;strong&gt;useReducer!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Counter 1: UseState Hook:&lt;/strong&gt; &lt;br&gt;
First thing to do is import &lt;em&gt;React and UseState.&lt;/em&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 React, {useState} from "react";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Set the State:&lt;/strong&gt; After importing, declare a useState then set the default count to "0"&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const [count, setCount] = useState(0);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Declare the Functions and set the Buttons:&lt;/strong&gt; &lt;em&gt;Increment, Decrement, Reset&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The increment button adds 1 to the input value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The decrement button subtracts 1 from the input value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Reset button sets the value back to the initial state '0'&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You also update the state of the count which was earlier set to '0' with &lt;em&gt;setCount.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const increment = (event) =&amp;gt; {
    event.preventDefault();
    setCount((prevCount) =&amp;gt; prevCount + 1);
  };
&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; const decrement = (event) =&amp;gt; {
    event.preventDefault();
    setCount((prevCount) =&amp;gt; prevCount - 1);
  };
&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;const reset = (event) =&amp;gt; {
    event.preventDefault();
    setCount(0);
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Input value function:&lt;/strong&gt; This changes the count value as you type in a value. &lt;br&gt;
&lt;em&gt;ParseInt returns an integer value to enable the increment&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const changeValue = (value) =&amp;gt; {
    setCount(parseInt(value));
  };

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;useState Code Block&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;import React, { useState } from "react";

function Counter() {
  const [count, setCount] = useState(0);

  const increment = (event) =&amp;gt; {
    event.preventDefault();
    setCount((prevCount) =&amp;gt; prevCount + 1);
  };

  const decrement = (event) =&amp;gt; {
    event.preventDefault();
    setCount((prevCount) =&amp;gt; prevCount - 1);
  };

  const reset = (event) =&amp;gt; {
    event.preventDefault();
    setCount(0);
  };
  const changeValue = (value) =&amp;gt; {
    setCount(parseInt(value));
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;div className="counter-container"&amp;gt;
        &amp;lt;h1&amp;gt;Count: {count}&amp;lt;/h1&amp;gt;
        &amp;lt;input type="number" placeholder="set value" /&amp;gt;
        &amp;lt;button
          onClick={(event) =&amp;gt; {
            if (event.key === "Enter") {
              changeValue(event.target.value);
            }
          }}
        &amp;gt;
          Enter
        &amp;lt;/button&amp;gt;
        &amp;lt;div className="counter"&amp;gt;
          &amp;lt;button onClick={increment} className="increment"&amp;gt;
            Increment
          &amp;lt;/button&amp;gt;
          &amp;lt;button onClick={decrement} className="decrement"&amp;gt;
            Decrement
          &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;button onClick={reset} className="reset"&amp;gt;
          Reset
        &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
  );
}
export default Counter;

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Counter 2: Using useReducer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Import ** React and useReducer** from react.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { useReducer } from "react";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Declare a default state variable and a useReducer function&lt;/strong&gt;&lt;br&gt;
 &lt;em&gt;using a switch case, set the increment, decrement, setvalue and update count state&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const reducer = (state, action) =&amp;gt; {
  switch (action.type) {
    case "increment":
      return { count: state.count + 1 };
    case "decrement":
      return { count: state.count - 1 };
    case "reset":
      return { count: (state.count = 0) };
    case "setvalue":
      return { ...state, input: action.payload };
    case "updatecount":
      return { count: action.payload };
    default:
      return { count: state.count };
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The dispatch sends an action to the reducer to update the state.&lt;/p&gt;

&lt;p&gt;updateTheCount function is used to update the count as you type in or change the input value.&lt;/p&gt;

&lt;p&gt;changeCountValue function is an event that changes the value on click&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function UseReducer() {
const [state, dispatch] = useReducer(reducer, initialCount);
  const updateTheCount = () =&amp;gt; {
    dispatch({ type: "updatecount", payload: state.input - `${state.count}` });
  };
  const changeCountValue = (e) =&amp;gt; {
    dispatch({ type: "setvalue", payload: e.target.value });
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;useReducer Code Block&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;import React from "react";
import { useReducer } from "react";

const initialCount = { count: 0, input: "" };
const reducer = (state, action) =&amp;gt; {
  switch (action.type) {
    case "increment":
      return { count: state.count + 1 };
    case "decrement":
      return { count: state.count - 1 };
    case "reset":
      return { count: (state.count = 0) };
    case "setvalue":
      return { ...state, input: action.payload };
    case "updatecount":
      return { count: action.payload };
    default:
      return { count: state.count };
  }
};

function UseReducer() {
const [state, dispatch] = useReducer(reducer, initialCount);
  const updateTheCount = () =&amp;gt; {
    dispatch({ type: "updatecount", payload: state.input - `${state.count}` });
  };
  const changeCountValue = (e) =&amp;gt; {
    dispatch({ type: "setvalue", payload: e.target.value });
  };
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h2 className="counter"&amp;gt;Count: {state.count}&amp;lt;/h2&amp;gt;
      &amp;lt;input
        type="number"
        value={state.input}
        onChange={changeCountValue}
        placeholder="set value"
      /&amp;gt;
      &amp;lt;button onClick={updateTheCount}&amp;gt;Enter&amp;lt;/button&amp;gt;
      &amp;lt;div className="counter"&amp;gt;
        &amp;lt;button className="inc" onClick={() =&amp;gt; dispatch({ type: "increment" })}&amp;gt;
          Increment
        &amp;lt;/button&amp;gt;
        &amp;lt;button className="dec" onClick={() =&amp;gt; dispatch({ type: "decrement" })}&amp;gt;
          Decrement
        &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;button className="reset" onClick={() =&amp;gt; dispatch({ type: "reset" })}&amp;gt;
        Reset
      &amp;lt;/button&amp;gt;
  );
}
export default UseReducer;

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

&lt;/div&gt;


&lt;p&gt;And that's a wrap! I hope you found this tutorial useful.&lt;br&gt;
You can check the full implementation on my github link here:&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ijayyyy"&gt;
        ijayyyy
      &lt;/a&gt; / &lt;a href="https://github.com/ijayyyy/count"&gt;
        count
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Created with CodeSandbox
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
count&lt;/h1&gt;
&lt;p&gt;Created with CodeSandbox
&lt;a href="https://count-app-one.vercel.app/" rel="nofollow"&gt;https://count-app-one.vercel.app/&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ijayyyy/count"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>counter</category>
      <category>codes</category>
      <category>usereducer</category>
    </item>
  </channel>
</rss>
