Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Cody Loyd
    @codyloyd
    yep
    Rhys
    @105ron
    const { currentUser, email } = this.props
    Andy
    @mindovermiles262
    ahh so it's mostly been replaced by es6
    Rhys
    @105ron
    Use destructuring for your props and state, it's sexy
    Cody Loyd
    @codyloyd
    right there are other ways of doing it
    but still kinda common
    Rhys
    @105ron
    Pamela Anderson sexy
    Javier M
    @Javier-Machin
    Pamela Anderson 20 years ago?
    Andy
    @mindovermiles262
    ^^ @105ron that's the same as
    const currentUser = this.props.currentUser
    const email = this.props.email
    ?
    Rhys
    @105ron
    Hmm... before she had Hep C
    Yes
    Andy
    @mindovermiles262
    @105ron ++ thanks
    odin-bot
    @odin-bot
    Woot! @105ron now has 725 points
    Rhys
    @105ron
    Then if you change to a functional component you only need to change the destructuring line
    You can also use it in the function arguments too const Component = ( { currentUser, email } ) => {
    Javier M
    @Javier-Machin
    is Axios the most used fetch replacement?
    Cody Loyd
    @codyloyd
    i think so
    it's the one i hear about the most
    Javier M
    @Javier-Machin
    oh it does the .json() for you
    Cody Loyd
    @codyloyd
    right on
    hey i saw a relevant tweet today
    just a sec
    Arun Kumar Mohan
    @arku
    @Javier-Machin Not just that
    Javier M
    @Javier-Machin
    yeah I just found out about it
    reading right now
    Javier M
    @Javier-Machin
    oh, Wes is using await
    I was starting to think I was a weirdo for going for it over .then
    Arun Kumar Mohan
    @arku

    With fetch, you've to check if the response is ok

    It won't raise an exception if the server threw a 404

    Hold on
    Let me grab a link
    Javier M
    @Javier-Machin
    ahh I see
    so you have to throw the error if it doesn't come up with "ok"
    otherwise it won't trigger the catch
    weird
    Javier M
    @Javier-Machin
    Thanks for the info BTW @arun1595 ++ @codyloyd ++
    odin-bot
    @odin-bot
    Woot! @arun1595 now has 926 points
    Woot! @codyloyd now has 1000002 points
    Javier M
    @Javier-Machin
    ^ :laughing:
    Arun Kumar Mohan
    @arku
    lol
    Briggs Elsperger
    @I3uckwheat
    hahaha
    Rhys
    @105ron
    /leaderboard
    odin-bot
    @odin-bot

    leaderboard partytime

    • 418918922507780096 [1532 points] :tada:
    • codyloyd [1530 points]
    • CouchofTomato [1355 points]
    • arun1595 [926 points]
    • mindovermiles262 [784 points]
    • see the full leaderboard here
    Rhys
    @105ron
    @418918922507780096 :star:
    Briggs Elsperger
    @I3uckwheat
    @codyloyd ^ LOL
    Cody Loyd
    @codyloyd
    bwahaha
    SARTHAK SHRESTHA
    @Sarthakraj
    new here...hello everyone Sarthak Shrestha from Nepal,hope you're having a good time
    Arun Kumar Mohan
    @arku
    @Sarthakraj Hey :wave: