<?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: Rafael Borges</title>
    <description>The latest articles on DEV Community by Rafael Borges (@rafaelborges26).</description>
    <link>https://dev.to/rafaelborges26</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%2F1112084%2Fee0c2844-e79c-4743-a79d-0631f326a998.jpeg</url>
      <title>DEV Community: Rafael Borges</title>
      <link>https://dev.to/rafaelborges26</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rafaelborges26"/>
    <language>en</language>
    <item>
      <title>How set, get and delete URL Params using React</title>
      <dc:creator>Rafael Borges</dc:creator>
      <pubDate>Thu, 27 Jun 2024 19:55:53 +0000</pubDate>
      <link>https://dev.to/rafaelborges26/how-set-and-get-url-params-using-react-21hl</link>
      <guid>https://dev.to/rafaelborges26/how-set-and-get-url-params-using-react-21hl</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Setting the URL Params:&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;import { useSearchParams } from 'react-router-dom'

//startar the variable params
const [searchParams, setSearchParams] = useSearchParams()

setSearchParams((state) =&amp;gt; {
  state.set('order', '123')

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Geting URL Params:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Accessing the route: &lt;a href="http://localhost:5173/dashboard?order=123"&gt;http://localhost:5173/dashboard?order=123&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We get this param like at example bellow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useSearchParams } from 'react-router-dom'

//startar the variable params
const [searchParams, setSearchParams] = useSearchParams()

//Get the param defined
const orderId = searchParams.get('order')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Deleting URL Params:&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;import { useSearchParams } from 'react-router-dom'

//startar the variable params
const [searchParams, setSearchParams] = useSearchParams()

//Delete the param order
setSearchParams((state) =&amp;gt; {
  state.delete('order')

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

&lt;/div&gt;



</description>
      <category>react</category>
      <category>typescript</category>
      <category>nextjs</category>
      <category>web</category>
    </item>
    <item>
      <title>Not allow user click to back to before page through button of navigator with React</title>
      <dc:creator>Rafael Borges</dc:creator>
      <pubDate>Thu, 27 Jun 2024 19:05:12 +0000</pubDate>
      <link>https://dev.to/rafaelborges26/not-allow-user-click-to-back-to-before-page-through-button-of-navigator-with-react-40ej</link>
      <guid>https://dev.to/rafaelborges26/not-allow-user-click-to-back-to-before-page-through-button-of-navigator-with-react-40ej</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useNavigate } from 'react-router-dom'

const navigate = useNavigate()

navigate('/sign-in', { replace: true })

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

&lt;/div&gt;



&lt;p&gt;Using replace true, the browser not allow back to back page after to navigate to sign-in route, how the example.&lt;/p&gt;

</description>
      <category>react</category>
      <category>web3</category>
      <category>router</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to create a dynamic, smooth-scrolling menu</title>
      <dc:creator>Rafael Borges</dc:creator>
      <pubDate>Thu, 20 Jul 2023 19:27:58 +0000</pubDate>
      <link>https://dev.to/rafaelborges26/learn-how-to-create-a-dynamic-smooth-scrolling-menu-5gjc</link>
      <guid>https://dev.to/rafaelborges26/learn-how-to-create-a-dynamic-smooth-scrolling-menu-5gjc</guid>
      <description>&lt;p&gt;&lt;em&gt;I am using react but is possible to use in all projects that use javascript how language.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To achieve this effect, you can implement a container div that splits the screen into sections with Id in each element:&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 page

      &amp;lt;div className="container"&amp;gt;
        &amp;lt;div className="content"&amp;gt;
          &amp;lt;div id="Profile"&amp;gt;
           &amp;lt;h1&amp;gt;Profile Content&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
&amp;lt;/p&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div id="ExperiencesContainer"&amp;gt;
            &amp;lt;h1&amp;gt;Experiences Content&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
&amp;lt;/p&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div id="AboutMe"&amp;gt;
            &amp;lt;h2&amp;gt;About me&amp;lt;/h2&amp;gt;
            &amp;lt;h3&amp;gt;I work with what I love&amp;lt;/h3&amp;gt;
&amp;lt;p&amp;gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
&amp;lt;/p&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;Our HTML Menu could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="containerMenu"&amp;gt;
                &amp;lt;button onClick={() =&amp;gt; handleNavigateMenu('Profile')}&amp;gt;Profile&amp;lt;/Tab&amp;gt;
                &amp;lt;button onClick={() =&amp;gt; handleNavigateMenu('AboutMe')}&amp;gt;About me&amp;lt;/Tab&amp;gt;
                &amp;lt;button onClick={() =&amp;gt; handleNavigateMenu('Experiences')}&amp;gt;Experiences&amp;lt;/Tab&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and this function from onClick:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//define this interface to use menu items without errors when call function handleNavigateMenu
export interface IMenuItems {
    items:
    | 'Profile'
    | 'Experiences'
    | 'AboutMe'
}

const handleNavigateMenu = (menuItems: IMenuItems['items']) =&amp;gt; {

  const element = document.getElementById(menuItems) //created a element
  if(element) {
    element.scrollIntoView({ behavior: 'smooth' }) //scrolling to element
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>react</category>
      <category>html</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How to compile styled-components on Next.js</title>
      <dc:creator>Rafael Borges</dc:creator>
      <pubDate>Sun, 02 Jul 2023 17:45:09 +0000</pubDate>
      <link>https://dev.to/rafaelborges26/how-to-compile-styled-components-on-nextjs-28d7</link>
      <guid>https://dev.to/rafaelborges26/how-to-compile-styled-components-on-nextjs-28d7</guid>
      <description>&lt;p&gt;if you are getting problem losing all the style from page, in the moment you render the application.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You just keep &lt;strong&gt;next.config.js&lt;/strong&gt; file as the exemple, adding the 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;  compiler: {
    styledComponents: true,
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;if you dont have this file on the projet, create it as the exemple.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S8ApN-YO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uuu2xpiaxjn5n87ppjfl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S8ApN-YO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uuu2xpiaxjn5n87ppjfl.png" alt="Structure root folder" width="398" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add this 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;const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  compiler: {
    styledComponents: true,
  },
}

module.exports = nextConfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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