Sha256: 4635811674121090e25376685c4848b1ac21f9e26859d577e0c00ad8edf7c8bc
Contents?: true
Size: 492 Bytes
Versions: 78
Compression:
Stored size: 492 Bytes
Contents
import qs from 'query-string'; import { useLocation } from 'react-router-dom'; // Allows hash and params e.g. "/foo#bar?query=baz" // returns { hash: "bar", params: { query: "baz" } } const useUrlParamsWithHash = () => { const { hash: fullParams } = useLocation(); const [hash, queryParams = {}] = fullParams.split('?'); const params = qs.parse(queryParams); const trimmedhash = hash.replace('#', ''); return { hash: trimmedhash, params }; }; export default useUrlParamsWithHash;
Version data entries
78 entries across 78 versions & 1 rubygems