0.3.1 • Published 11 months ago

use-hash-param v0.3.1

Weekly downloads
88
License
ISC
Repository
github
Last release
11 months ago

useHashParam

Package version on NPM Build status Bundle size

React hook that allows to keep your state in sync with URL parameters.

Installation

npm install --save use-hash-param

Usage

import React from "react";
import useHashParam from "use-hash-param";

function ControlledInput() {
  const [name, setName] = useHashParam("name");

  return <input value={name || ""} onChange={(e) => setName(e.target.value)} />;
}

Anything you type into the input will be reflected in the address bar (e.g. http://localhost:3000/#?name=Peter). And if you open a link with such a parameter, the field will be populated automatically!

Example

0.3.1

11 months ago

0.3.0

1 year ago

0.2.4

4 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago