<?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: Mohamed Atef</title>
    <description>The latest articles on DEV Community by Mohamed Atef (@tefa).</description>
    <link>https://dev.to/tefa</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%2F435043%2Fcf4f1e63-948c-4bf3-8397-2b1f6be9226d.jpeg</url>
      <title>DEV Community: Mohamed Atef</title>
      <link>https://dev.to/tefa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tefa"/>
    <language>en</language>
    <item>
      <title>why Next.js is the best choice for create a blog site or even using it with wordpress ? 🤔😉</title>
      <dc:creator>Mohamed Atef</dc:creator>
      <pubDate>Wed, 21 Sep 2022 19:36:08 +0000</pubDate>
      <link>https://dev.to/tefa/why-nextjs-is-the-best-choice-for-create-a-blog-site-or-even-using-it-with-wordpress--1fia</link>
      <guid>https://dev.to/tefa/why-nextjs-is-the-best-choice-for-create-a-blog-site-or-even-using-it-with-wordpress--1fia</guid>
      <description>&lt;p&gt;We are now seeing the huge number of blogging sites, whether on your own application or on sites ready for blogs such as WordPress, Blogger and others&lt;br&gt;
_Of course, one of them is me 😀 😀&lt;/p&gt;

&lt;p&gt;Now what distinguishes sites from each other is not only the quality of the content, but the ease, speed, efficiency and responsiveness&lt;br&gt;
&lt;strong&gt;Here we have &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  First let me define Next.js:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Next.js&lt;/strong&gt; is a JavaScript framework created by** Zeit**. It allows you to create server-side rendering and static web applications using React. It's a great tool for building your next website. It has many great features and advantages, which can make Nextjs your first choice for building your next web application.&lt;/p&gt;

&lt;p&gt;Next.js comes with a bunch of cool features like &lt;u&gt;server-side&lt;/u&gt; &lt;u&gt;rendering,&lt;/u&gt; &lt;u&gt;routers,&lt;/u&gt; and &lt;u&gt;slow loading&lt;/u&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server-side rendering:&lt;/strong&gt;&lt;br&gt;
Next.js performs server-side rendering by default. This makes your application optimized for search engines. You can also integrate any middleware like &lt;a href="https://expressjs.com/"&gt;express.js&lt;/a&gt; or &lt;a href="https://hapi.dev/"&gt;Hapi.js&lt;/a&gt;, and you can run any database like &lt;a href="https://www.mongodb.com/"&gt;MongoDB&lt;/a&gt; or&lt;a href="https://www.mysql.com/"&gt; MySQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next.js comes with a header component that allows you to add and create dynamic meta tags.&lt;br&gt;
These make your website able to be indexed by search engines like Google.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a static website with Next.js&lt;/strong&gt;&lt;br&gt;
In addition to server-side rendering, you can still compile and export your app as an HTML static website and publish it to a static hosting website like a &lt;a href="https://github.com/"&gt;GitHub&lt;/a&gt; page or &lt;a href="https://www.netlify.com/"&gt;netlify&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;routers&lt;/strong&gt;&lt;br&gt;
This is another great feature of Next.js. When using the create-reaction-app, you usually need to install the interactive router and create its own custom configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;lazy loading&lt;/strong&gt;&lt;br&gt;
Slow loading makes your app offer a better user experience. Sometimes it may take a while for the page to load. The user may abandon your app if it takes more than 30 seconds to load.&lt;/p&gt;

&lt;p&gt;The way to avoid this is to use some trick to indicate to the user that the page is loading, for example by displaying a turntable. Lazy loading or code splitting is one feature that allows you to handle and control lazy loading so that you only load the necessary code on your page.&lt;/p&gt;

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

&lt;p&gt;These features make next.js the best choice to start blogging and profit from it in the best possible way&lt;/p&gt;

&lt;p&gt;Building a blog with Next.js is today's top choice for those who want a simple yet powerful blog - without ending up with a lot of code and while increasing our SEO rankings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SEO&lt;/strong&gt; (Search Engine Optimization) is the process of optimizing your app to rank better on search engines. It is very important for any blog that wants to rank better on search engines and bring in more traffic. A good app with poor SEO rankings will not be productive, effective, or successful.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>blog</category>
      <category>wordpress</category>
      <category>react</category>
    </item>
    <item>
      <title>Simple Validation Form In React Using UseHooks And LocalStorage With Some Tailwind🥳🎉</title>
      <dc:creator>Mohamed Atef</dc:creator>
      <pubDate>Wed, 10 Aug 2022 20:43:36 +0000</pubDate>
      <link>https://dev.to/tefa/simple-validation-form-in-react-using-usehooks-and-localstorage-with-some-tailwind-4d2c</link>
      <guid>https://dev.to/tefa/simple-validation-form-in-react-using-usehooks-and-localstorage-with-some-tailwind-4d2c</guid>
      <description>&lt;p&gt;Hello Everyone Who Came to My Blog, I Really Appreciate that and hope i could to help you to create simple Validation Register Form.🙏🙏&lt;/p&gt;

&lt;p&gt;I Don't Want To Write Long Blog , So Let's Dive into the code . 👨‍💻 👩‍💻&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;First Let's Write Simple jsx code:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div
      className="login grid place-content-center  
    bg-gradient-to-r from-purple-900 via-purple-1000 to-blue-800 "
    &amp;gt;
      &amp;lt;form
        className="card grid place-content-center  h-96 w-96  
       "
        onSubmit={handleSubmit}
      &amp;gt;
        &amp;lt;label htmlFor=""&amp;gt;name:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          value={name}
          placeholder="Enter Your Name"
          onChange={(e) =&amp;gt; setName(e.target.value)}
        /&amp;gt;
        {errors.name}

        &amp;lt;label htmlFor="email"&amp;gt;Email:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="email"
          placeholder="email address"
          id="email"
          value={email}
          onChange={(e) =&amp;gt; setEmail(e.target.value)}
        /&amp;gt;
        {errors.email}

        &amp;lt;label htmlFor="password"&amp;gt;Password:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="password"
          value={password}
          id="password"
          onChange={(e) =&amp;gt; setPassword(e.target.value)}
        /&amp;gt;
        {errors.password}

        &amp;lt;label htmlFor="phoneNumber"&amp;gt;phone Number:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          value={phoneNumber}
          placeholder="phone Number"
          id="phoneNumber"
          onChange={(e) =&amp;gt; setPhoneNumber(e.target.value)}
        /&amp;gt;

        &amp;lt;div className="buttons flex gap-3 justify-center mt-5"&amp;gt;
          &amp;lt;button type="submit" className="btn-1"&amp;gt;
            Sign Up
          &amp;lt;/button&amp;gt;
          &amp;lt;button&amp;gt;
            &amp;lt;Link
              className="
        "
              to="/login"
            &amp;gt;
             Login{" "}
            &amp;lt;/Link&amp;gt;
          &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;2- Second It's Time to Make this form Dynamic :&lt;br&gt;
 We Need First To Initiate the UseState Hooks that we use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const [email, setEmail] = useState("")
         const [password, setPassword] = useState("")
         const [name, setName] = useState("")
         const [phoneNumber, setPhoneNumber] = useState("")
         const [errors, setErrors] = useState({})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Prepare the Submit Button As Like that&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleSubmit = (e) =&amp;gt; {
    e.preventDefault()
    formValidation()
    setUsers([...users, { email: email, password: password }])
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;And Now It's Time To Hit Some Conditions for the Right Register&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const formValidation = () =&amp;gt; {
    let newErrors = {}
    if (name === "") {
      newErrors.name = &amp;lt;h1 className="text-red-800 text-center"&amp;gt;
        Name Can't Be Blanck&amp;lt;/h1&amp;gt;
    }
    if (email === "") {span
      newErrors.email = &amp;lt;span className="text-red-800 text-center"&amp;gt;
         Email Address Is Required&amp;lt;/span&amp;gt;
    } else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
      newErrors.email = &amp;lt;span className="text-red-800 text-center"&amp;gt;
        Email address is invalid&amp;lt;/span&amp;gt;
    } else {
      newErrors.email = &amp;lt;h1 className="text-green-800 text-center "&amp;gt;
        Email is Valid&amp;lt;/h1&amp;gt;
    }
    if (password === "") {
      newErrors.password = &amp;lt;span className="text-red-800 text-center"&amp;gt;
        Password Is Required&amp;lt;/span&amp;gt;
    } else if (!/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,15}$/.test(password)) {
      newErrors.password = &amp;lt;span className="text-red-800 text-center"&amp;gt;
        Invalid Password Format&amp;lt;/span&amp;gt;
    } else {
      newErrors.password = &amp;lt;span className="text-green-800 text-center "&amp;gt;
        Correct Password&amp;lt;/span&amp;gt;
    }
    setErrors(newErrors)
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &amp;gt; And The Final Step is Saving the user's data in localstorage in this way:
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;We can initiate the localstorage&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [users, setUsers] = useState(() =&amp;gt; {
    const data = localStorage.getItem("data")
    return data ? JSON.parse(data) : []
  })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;And Using UseHooks to Watch if there is not a user in localstorage before to set a new one&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    localStorage.setItem("data", JSON.stringify(users))
  }, [users])

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/mohamedatef73"&gt;👉 Visit my github account&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &amp;gt; Conclusion:
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;In the end, I tried to write a simple validation form to learn how to use usehooks and also save it in localstorage. I hope that I was able to help you, and good luck always&lt;/p&gt;
&lt;/blockquote&gt;

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