react-hook-object
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

React hook object

An easy way to cache your inline object references.

import { useState } from "react";
import { useObject } from "react-hook-object";

const ProductTable = () => {
  const [query, setQuery] = useState("");
  const [sort, setSort] = useState("DESC");
  const tableParams = useObject({
    sort,
    query,
    dateFrom: new Date(2022, 0, 1),
  });

  return <Table tableParams={tableParams} data={data} />;
};
  • [x] 0 dependencies
  • [x] supports primitive values (boolean, string, number...)
  • [x] supports objects (as long as object.valueOf() returns a primitive value, ie Date)
  • [x] TypeScript support

Package Sidebar

Install

npm i react-hook-object

Weekly Downloads

2

Version

1.0.1

License

mpl-2.0

Unpacked Size

19.7 kB

Total Files

5

Last publish

Collaborators

  • kkotlarski