Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add query parameter to url react router v6

const Users = () => {
  const navigate = useNavigate();
  const goToPosts = () =>
    navigate({
      pathname: '/posts',
      search: '?sort=date&order=newest',
    });

  return (
    <div>
      Users
      <button onClick={goToPosts}>Go to Posts</button>
    </div>
  );
};
Comment

how to add query parameter to url reactjs

history.push({
  pathname: '/dresses',
  search: '?color=blue'
})

or

history.push('/dresses?color=blue')
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native gradient 
Javascript :: axios error 
Javascript :: how to use useparams in react 
Javascript :: toggle class jquery not working 
Javascript :: nodejs buffer.from base64 
Javascript :: js loop over array of objects extract value 
Javascript :: angular http loader 
Javascript :: string to object 
Javascript :: axios cancel request 
Javascript :: urlencoded limit nodejs 
Javascript :: npm add latest version to package json 
Javascript :: how to sort json objects 
Javascript :: how to separate thousands with comma in js 
Javascript :: how to show modal with jquery 
Javascript :: how to change the color of a console.log in javascript 
Javascript :: enzyme-to-json 
Javascript :: copy object array javascript 
Javascript :: check if browser is internet explorer js 
Javascript :: convert image object to blob javascript 
Javascript :: encrypt javascript node 
Javascript :: javascript get referrer 
Javascript :: javascript number format 
Javascript :: sort nested data using sort function javascript 
Javascript :: connecting nodejs using mongoose 
Javascript :: switch js 
Javascript :: upload files to api using axios 
Javascript :: Disable click for specific elements javascript 
Javascript :: how to find hcf of 2 numbers in javascript 
Javascript :: javascript function to open file browser 
Javascript :: ajax get method in jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =