Skip to content

Files

Latest commit

 

History

History
34 lines (26 loc) · 844 Bytes

nested-destructuring.md

File metadata and controls

34 lines (26 loc) · 844 Bytes
id sidebar_label title description keywords version image
nested-destructuring
Nested destructuring
Nested Destructuring
Nested destructuring | React Patterns, techniques, tips and tricks in development for Ract developer.
nested destructuring
reactpatterns
react patterns
reactjspatterns
reactjs patterns
react
reactjs
react techniques
react tips and tricks
Nested destructuring
/img/reactpatterns-cover.png

Destructuring also applies to objects nested in objects.

For example

Without destructuring:

function setIndexFromRoute(props) {
  const modalList = props.modalList
  const pathname = props.location.pathname

  // ...
}

Destructuring the nested props object.

function setIndexFromRoute(props) {
  const { modalList, location: { pathname } } = props

  // ...
}