use-state-object
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

useStateObject hook

Build Status codecov npm

A React functional component hook to mimic Class component object state management.

Examples:

State declaration:

const [state, useState] = useState({
  isLoading: false,
  isError: false
});

Usage:

// State will be merged with the object you provide to setState instead of being replaced
setState({
  isLoading: true
});
 
// State is now
// {
//    isLoading: true,
//    isError: false
// }

Package Sidebar

Install

npm i use-state-object

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

12.5 kB

Total Files

10

Last publish

Collaborators

  • justindng