@livestd/react-router-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

NPM

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} />)
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    4

Package Sidebar

Install

npm i @livestd/react-router-utils

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

9.45 kB

Total Files

6

Last publish

Collaborators

  • rtishchev