Ninjas Practicing Multidimensionality

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

    Install

    npm i @livestd/react-router-utils

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    9.45 kB

    Total Files

    6

    Last publish

    Collaborators

    • rtishchev