what is this syntaxt? const { data: session } = useSession()
Unanswered
American Curl posted this in #help-forum
American CurlOP
hi im new to nextjs/node/react, etc.. but what is this syntax exactly? it is from next-auth
what is data (other than a "property" as vscode says when i hover it and why the need for curly brackets
const { data: session } = useSession()what is data (other than a "property" as vscode says when i hover it and why the need for curly brackets
2 Replies
@American Curl hi im new to nextjs/node/react, etc.. but what is this syntax exactly? it is from next-auth
`const { data: session } = useSession()`
what is data (other than a "property" as vscode says when i hover it and why the need for curly brackets
it's called destructuring https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
the above code is equivalent to
the above code is equivalent to
const session = useSession().dataAmerican CurlOP
I see. thank you