access nested state value in hookstate code example
Example: access nested state value in hookstate
// However, there is a nested state method, which allows to access nested state by name.
// example :-
state = {
user: {
name: { firstName: 'Kaushal', lastName: 'Shah' }
}
};
// To access state =>
state
// To access user =>
state.user or state.nested('user')
// To access name =>
state.user.nested('name')
// To access firstName =>
state.user.nested('name').nested('firstName')