loading...

re: Train wagons 🚃.🚃.🚃 VIEW POST

FULL DISCUSSION
 

You can also write the second approach without promises (because there is nothing async after the first element) and it's a bit faster :)

promise.then(({data})=>{
      const {users} = data
      const [firstUser] = users
      const {name="mike"} = firstUser
})

or if you just care about firstUser:

promise.then(({data: {users: [firstUser]}})=>{
     const {name} = firstUser
})
 
code of conduct - report abuse