In my code, I have set up three constants based on an object.
const {standing_bid_amt, min_increment, starting_price} = props.auction.auction;
The problem arises when the object auction
is empty, resulting in the constants being undefined
. To address this issue, I have modified the code to
const {standing_bid_amt, min_increment, starting_price} = props.auction.auction
? props.auction.auction
: {standing_bid_amt: null, min_increment:null, starting_price:null};
While this solution works, I have a feeling that there might be a better way to handle null checks for these constants. Please share if there is a more efficient approach to create these constants with a proper null check.