@livestd/react-router-utils
v1.0.0
Published
Utils and hooks for react-router
Downloads
3
Maintainers
Readme
Utils and hooks for react-router
Installation
npm install --save @livestd/react-router-utils
useQuery
interface Query {
// properties
params: Record<string, any>;
// methods
push: (params: {}) => void;
replace: (params: {}) => void; // replace on history
}
// type
useQuery = (): Query;
Usage
import { useQuery } from '@livestd/react-router-utils';
const Component = () => {
const {params, push} = useQuery();
useEffect(() => console.log(params));
const pushParam = () => {
push({param: 1});
};
return (<button onClick={pushParam} />)
}