1.1.0 • Published 4 years ago

use-state-object v1.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

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