is this a correct syntax const [response] = await tasks.createTask()
Im familiar with the object destructuring method but this looks kinda weird
S3BAS12/1/2022
yeah it's valid syntax
Message Not Public
Sign In and Join Server To See
12/1/2022
Script12/1/2022
oh but how does it work tho I tried testing it by creating a function to return an array ["response", "jason"]
then I didconst ["jason"] = function();` then console logged it and it kept on returning "response"
S3BAS12/1/2022
The word that goes in the [] is the assigned variable name
horse and tiger can be whatever you want, it's the name of the variable you are declaring
Script12/1/2022
oh same way with useState so it doesnt matter what i name the first and second index, the first would always be the state variable then the second would always be what changes the state variable
Solution Message
S3BAS12/1/2022
Yeah, because useState returns an array, the first element holding the current value and the second giving you the function that can update it