<?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: Paw</title>
    <description>The latest articles on DEV Community by Paw (@paw07380932).</description>
    <link>https://dev.to/paw07380932</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%2F410358%2Ff59436ff-978e-48bc-9c19-269b60410332.png</url>
      <title>DEV Community: Paw</title>
      <link>https://dev.to/paw07380932</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paw07380932"/>
    <language>en</language>
    <item>
      <title>Redirect all url with # from HashRouter to BrowserRouter</title>
      <dc:creator>Paw</dc:creator>
      <pubDate>Sat, 27 Jun 2020 10:07:18 +0000</pubDate>
      <link>https://dev.to/paw07380932/redirect-all-url-with-from-hashrouter-to-browserrouter-34eb</link>
      <guid>https://dev.to/paw07380932/redirect-all-url-with-from-hashrouter-to-browserrouter-34eb</guid>
      <description>&lt;p&gt;I changed HashRouter to BrowserRouter and now I would like to redirect all urls to remove # from them. (Url are in e.g. mailing - so I have to do it).&lt;/p&gt;

&lt;p&gt;I found a similar topic to this, but none of the solutions there works for me.&lt;br&gt;
&lt;/p&gt;

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

class Index extends Component {

    render() {

        return (
&amp;lt;BrowserRouter&amp;gt;
  &amp;lt;Switch&amp;gt;
    &amp;lt;Route exact path={"/"} component={() =&amp;gt; &amp;lt;HomePage /&amp;gt;}/&amp;gt;
    &amp;lt;Redirect from='/#/bus/:category' to '/bus/:category' /&amp;gt;
    &amp;lt;Route exact path='/bus/:category' component={BusCategory} /&amp;gt;
  &amp;lt;/Switch&amp;gt;
&amp;lt;/BrowserRouter&amp;gt;
        )
    }
}

ReactDOM.render(&amp;lt;Index /&amp;gt;, document.getElementById("index"));
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It's redirecting only to HomePage.&lt;/p&gt;

&lt;p&gt;Next solution also not working:&lt;br&gt;
&lt;/p&gt;

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

class Index extends Component {

    render() {


 const history = useHistory()

  if (location.hash.startsWith('#/')) {
    history.push(location.hash.replace('#', '')) // or history.replace
  }

        return (
&amp;lt;BrowserRouter&amp;gt;
  &amp;lt;Switch&amp;gt;
    &amp;lt;Route exact path={"/"} component={() =&amp;gt; &amp;lt;HomePage /&amp;gt;}/&amp;gt;
    &amp;lt;Route exact path='/bus/:category' component={BusCategory} /&amp;gt;
  &amp;lt;/Switch&amp;gt;
&amp;lt;/BrowserRouter&amp;gt;
        )
    }
}

ReactDOM.render(&amp;lt;Index /&amp;gt;, document.getElementById("index"));

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



&lt;p&gt;and the last one also nothning :(&lt;br&gt;
&lt;/p&gt;

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

class Index extends Component {

    render() {

        return (
&amp;lt;BrowserRouter&amp;gt;
  &amp;lt;Switch&amp;gt;
    &amp;lt;Route exact path={"/"} component={() =&amp;gt; &amp;lt;HomePage /&amp;gt;}/&amp;gt;
    &amp;lt;Route exact path='/bus/:category' component={BusCategory} /&amp;gt;
    &amp;lt;Route path={"/bus/:category"} render={({ location }) =&amp;gt; &amp;lt;Redirect strict to={location.hash.replace('#', '')} /&amp;gt;} /&amp;gt;

  &amp;lt;/Switch&amp;gt;
&amp;lt;/BrowserRouter&amp;gt;
        )
    }
}

ReactDOM.render(&amp;lt;Index /&amp;gt;, document.getElementById("index"));
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I've probably already tried all the options, if anyone can help me I'll be extremely grateful.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Filter Search in React, how to do 'nothing was found'</title>
      <dc:creator>Paw</dc:creator>
      <pubDate>Tue, 16 Jun 2020 15:03:02 +0000</pubDate>
      <link>https://dev.to/paw07380932/filter-search-in-react-how-to-do-nothing-was-found-5c7e</link>
      <guid>https://dev.to/paw07380932/filter-search-in-react-how-to-do-nothing-was-found-5c7e</guid>
      <description>&lt;p&gt;Hi everyone! I'm sorry for my very poor english. :(&lt;/p&gt;

&lt;p&gt;I have a problem creating a condition that would inform users that nothing was found. I have already tried by all means until I finally gave up and write to you asking for help.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import React, {Component} from "react";
import {Link} from "react-router-dom";

class SearchCars extends Component{

    const allCars = [
        {name: CarA, vin: exampleVin1},
        {name: CarB, vin: exampleVin2}
    ]

    state = {
        filterText: '',
        showSearch: false
    };

    handleSearch = e =&amp;gt; {
        this.setState({
            filterText: e.target.value.toLowerCase()
        })
    };

    handleShowSearch = e =&amp;gt; {
        this.setState({
            showSearch: !this.state.showSearch,
            filterText: ''
        })
    };

    render() {
        let table = [];
        let lastCategory = null;

        allCars.filter( el =&amp;gt; {
            if (el.name.toLowerCase().indexOf(this.state.filterText) === -1){
                return null;
            }
            if (el.vin !== lastCategory){
                table.push(
                    &amp;lt;a className='search_items_links' onClick={()=&amp;gt; {this.handleShowSearch();}} key={el.vin} &amp;gt;
                        &amp;lt;div className='search_items'&amp;gt;{el.name}&amp;lt;/div&amp;gt;
                    &amp;lt;/a&amp;gt;
                )
            }

            lastCategory = el.vin;
        });

        let addClassSearch = this.state.filterText.length &amp;gt; 0 ? "search search_active" : "search";
        let toggleClassX = this.state.filterText.length &amp;gt; 0 ? "search_close search_close_active" : "search_close";

        if (this.state.showSearch === true){
            return (
                &amp;lt;&amp;gt;
                    &amp;lt;div className={addClassSearch}&amp;gt;
                        &amp;lt;input autoFocus
                               type='text'
                               placeholder='search'
                               value={this.state.filterText}
                               onChange={this.handleSearch}
                        /&amp;gt;
                        &amp;lt;div onClick={this.handleShowSearch} className={toggleClassX}&amp;gt;
                            &amp;lt;img src='../images/close.png'/&amp;gt;
                        &amp;lt;/div&amp;gt;
                        &amp;lt;div className='search_list'&amp;gt;
                            {
                                this.state.filterText.length === 1 &amp;amp;&amp;amp; &amp;lt;a className='search_items_links'&amp;gt;&amp;lt;div className='search_items'&amp;gt;Too short...&amp;lt;/div&amp;gt;&amp;lt;/a&amp;gt; ||
                                this.state.filterText.length &amp;gt; 1 &amp;amp;&amp;amp; table
                            }
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/&amp;gt;
            )
        } else{
            return (
                &amp;lt;div className='search_icon_display'&amp;gt;
                    &amp;lt;div className='search_zoom-icon'&amp;gt;&amp;lt;img onClick={this.handleShowSearch}
                                                           onMouseEnter={this.hoverIcon}
                                                           onMouseOut={this.hoverIcon}
                                                           src={this.state.hoverIcon ? '../images/search-icon_hover.png' : '../images/search-icon.png'}/&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;

            )
        }


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

</description>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
