New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-nested-state

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-nested-state

The `react-nested-state` library provides a convenient way for React developers to manage and update nested states within functional components. It offers a hook called `useNestedState` that simplifies the process of setting nested states and provides eas

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

react-nested-state

The react-nested-state library provides a convenient way for React developers to manage and update nested states within functional components. It offers a hook called useNestedState that simplifies the process of setting nested states and provides easy-to-use setters for various levels of nesting. This can be particularly useful when dealing with complex state structures.

Installation

You can install the react-nested-state library using npm:

npm install react-nested-state

Example

const [state, setters, reset] = useNestedState(initialState);
const initialState = {
  name: "John",
  age: 20,
  a: {
   b: {
    c: 10
   }
 },

 ...

 const [state, setters, reset] = useNestedState(initialState);
 setters.name.set("Jane");
 setters.age.set(21);
 setters.a.b.c.set(11);

Keywords

react

FAQs

Package last updated on 01 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts