Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get data from mulitple query parameters react

import React from 'react';
import {useLocation} from "react-router-dom";

export default function Items() {
 //Where parameter url = localhost:3000/items?name=pen&id=12
  const search = useLocation().search;
  const name = new URLSearchParams(search).get('name');  const id = new URLSearchParams(search).get('id');
  return (
    <div>
      <h1>Items page</h1>
      <p>{id}</p>      <p>{name}</p>    </div>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to change elemen size in js when custom page width changed 
Javascript :: conditionally add property to object 
Javascript :: json mapper 
Javascript :: jquery console.log object file 
Javascript :: find in array and return true or false react js 
Javascript :: preventdefault called two times 
Javascript :: create 24 hours array like 00:00 to 23:30 
Javascript :: jquery-3.2.1.min.js file download 
Javascript :: detect nodejs 
Javascript :: e.stopPropagation() is not working as expected 
Javascript :: react load after scrolling 
Javascript :: dsicrod.js bot answer to himself 
Javascript :: axios get request with body 
Javascript :: how to get value from select option using input name in jquery 
Javascript :: javascript to prevent method POST from realoading 
Javascript :: nodejs css cotent tipe 
Javascript :: get members of a group graph pnp js 
Javascript :: ex:h2p 
Javascript :: khai bao bien js 
Javascript :: Raphael JS store arbitrary data 
Javascript :: straforma in string js 
Javascript :: how to install ruchi js 
Javascript :: change the body background color with javascript 
Javascript :: firebase is there a way to rename a document 
Javascript :: select div with specific class not all divs jquery 
Javascript :: babel 7 ReferenceError: regeneratorRuntime 
Javascript :: Function Recurser / Infinit Calling 
Javascript :: filebase64 template 
Javascript :: guage chart highchart codepen 
Javascript :: firestore get first document in collection and delete it 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =