Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useSearchParams()

import { useSearchParams } from 'react-router-dom'

function Mobile() {
    const [search,setSearch]=useSearchParams();
    const checkValue = search.get('filter') === 'active';
    console.log(checkValue);
  return (
    <div>
        <button onClick={()=>setSearch({filter: 'active'})}>Show Mobile Under 50K</button>
        <button onClick={()=> setSearch('')}>Show HighEnd Mobiles</button>
Source by reactrouter.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+3 =