-2

What does this assignment mean?

const { data: scoreData } = useMostRecentScore(studentId, loginId)
Evert
  • 93,428
  • 18
  • 118
  • 189
  • Same thing it would in JavaScript, there's no type information in what you've shown. – jonrsharpe Jul 01 '22 at 16:52
  • 1
    It means `scoreData` will reference the `data` property of whatever `useMostRecentScore` returns. This is [object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#object_destructuring). – Dave Newton Jul 01 '22 at 16:53

1 Answers1

0

If useMostRecentScore returns an object, with a data property, it will create a new variable called scoreData and assign the contents of the data property.

Evert
  • 93,428
  • 18
  • 118
  • 189