Skip to content

Instantly share code, notes, and snippets.

@thurt
thurt / ExampleQueryParameters.js
Last active April 2, 2020 21:31
Manually get or set more than one query parameter
import React, { useEffect, useState } from "react";
import { useLocation, useHistory } from "react-router";
const ExampleQueryParameters = () => {
const history = useHistory();
const [state, setState] = useState(
Object.fromEntries(new URLSearchParams(useLocation().search))
);
useEffect(() => {