Skip to content

State #3

@bmsteven

Description

@bmsteven

How to declare a new state in react using useState hook? Assuming we use functional components in this whole journey.
How to update state?
State accepts any type of data from strings, booleans, arrays, objects, numbers etc, how to update a single key in an object while leaving other keys unaffected? How to update array data( adding or removing an item in an array)?
Assume array of objects is passes as a state, how to update a single key in a single object of an array without affecting other keys of a particular object and without affecting other objects in the array?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions