In React custom hook we are returning ordernumber in the below way what does question mark after the variable receipt?.order?.id
means in react
export const useTest = props => {
...
return {
orderTestNumber: receipt?.test?.id
};
}
its called Optional chaining (?.)
The optional chaining operator provides a way to simplify accessing values through connected objects when it's possible that a reference or function may be undefined or null.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With