Creating an onClick event to open a cart drawer and receiving the error 'Cannot restructure property 'shoppingCartOpen' of 'value' as it is undefined'. How do I resolve it?
const ButtonAppBar = ({value}) => {
  const { shoppingCartOpen } = value
  let shoppingCartDrawer;
  if (this.state.shoppingCartOpen) {
    shoppingCartDrawer = <ShoppingCartDrawer />;
  }
 
                        
The error isn't in this code snippet you've posted, it's in how you're calling it. You're expecting
valueto be an object with the propertyshoppingCartOpen, so ifvalueisundefined, then this line is a problem:const { shoppingCartOpen } = value.You can default
valueto an empty object to supress errorsBut make sure that you are actually passing the right
valueto the props when you call it! It should look like: