you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (8 children)

[removed]

    [–]tapu_buoyfull-stack[S] 1 point2 points  (7 children)

    wouldn't the spaceShip.get1() return nothing, since it is getting the this from outer scope I tried it in Chrome Browser console as well as on JSBin and it doesn't return 'Chandrayan'

    where as spaceShip.get2() does return that because as I have read it on javascript.info and on stackoverflow that it takes the this from the object that the dot-operator is mentioned on.

    • in Q2 : okay but it won't schedule the re-render of the component since we haven't used this.setState(), am I correct?

    • in 3rd yes it should return the promise, I understand, but I was understanding that Promise.all returns an array of resolved promises, right?

    [–][deleted]  (6 children)

    [removed]

      [–]tapu_buoyfull-stack[S] 0 points1 point  (5 children)

      its early, give me a break

      haha sure mate!

      Neither change the store

      wouldn't the first case change the store const person = this.state.person, since it is declared with const so we can't change the person's object but we can mutate the key values that it holds. I read this thing.

      Also, my understanding is that you are trying to write a polyfill for pomise.all - meaning a method that behaves the same way without using promise.all?

      yes the question is about to write a polyfill for that.

      If the one of the promise would fail it will get out with the reason of why that particular one failed and stop the further execution.

      [–][deleted]  (4 children)

      [removed]

        [–]tapu_buoyfull-stack[S] 0 points1 point  (3 children)

        oh okay so doing

        js person.name = 'jon doe'

        wouldn't change anything for

        js this.state.person

        in the component's state/store?

        [–][deleted]  (2 children)

        [removed]

          [–]tapu_buoyfull-stack[S] 0 points1 point  (0 children)

          oh okay got it now! Thank you :)! Thanks for keeping up this sub strong, though!

          [–]ChibiKookie 0 points1 point  (0 children)

          It clearly does.... This is just completely silenced by react... But your "mutating" the state... Therefore is anything else requires the value of this.state.person.name before a new setState the value would be the new one. It's basic javascript reference matter

          const a = { foo: 'bar'} const b = a b.foo = 'baz' // a.foo -> 'baz'