Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Ayush Bahuguna
@relentless-coder
@kbaig leave it, I am going crazy due to AWS Developer Support's service.
Amit Patel
@AmitP88
I need to take the absolute simplest approach to problems now. thanks guys :) I'll restudy this solution for a while, make sure I get the lesson lol
ehutchllew
@ehutchllew
@zifahm yeah, like
_getRecipes(){
   this.state.map( () => {
   // logic goes here, then return
    }
}

render(){
  return(
      {this._getRecipes()}
);
}
Muhammed Hafiz
@zifahm
@ehutchllew okay let me try :smile:
Kaz Baig
@kbaig
@relentless-coder well the fastest way to do it logically would be to replace each item in the array with the highest item in the array, which is what I'm doing
ehutchllew
@ehutchllew
@zifahm Or instead of directly calling the function in the render return, try setting the function output to constructor variables or state variables and then populating your HTML based off of said variables.
Kaz Baig
@kbaig
It would be faster if you used for loops probably since apparently they're faster than Array methods
ehutchllew
@ehutchllew
@kbaig If I'm not mistaken, map and forEach are faster than for
I could be wrong though, I'm not an expert haha
Toni Shortsleeve
@KoniKodes
@zifahm I'm sorry. I do think @ehutchllew is correct.
Muhammed Hafiz
@zifahm
what to do
ehutchllew
@ehutchllew
@zifahm okay so my suggestion is, if it's still not working, take a step back and just get something extremely basic to render like: <div><p> HI </p> </div> add some styling to it to make sure it's not empty, and then work up from there.
Muhammed Hafiz
@zifahm
okay
@ehutchllew see now it renders without the map
ehutchllew
@ehutchllew
@zifahm Okay I'm testing some stuff gimme one sec
Muhammed Hafiz
@zifahm
@ehutchllew thank you
CamperBot
@camperbot
zifahm sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @ehutchllew |http://www.freecodecamp.org/ehutchllew
ehutchllew
@ehutchllew
@zifahm So I've never used react on codepen, but when I check what the return is on a map function it just says function() { [native code] } trying to figure out what is going on.
Muhammed Hafiz
@zifahm
i typed h1 above map and it renders @ehutchllew
Kaz Baig
@kbaig
@ehutchllew [native code] refers to code native to the browser, might need more context
ehutchllew
@ehutchllew
@zifahm yeah, it's not liking the expression in the html for some reason, going to try storing values on a state variable and re-rendering. Hold up.
Muhammed Hafiz
@zifahm
how am i suppose to complete this challenge without codepen?
LydaTech
@lydatech
@zifahm why cant you use codepen?
ehutchllew
@ehutchllew
@zifahm this is weird, using map or forEach seems to break it.
Muhammed Hafiz
@zifahm
@lydatech this code dosent render when there is map func in it, i took out the map and it renders quite fine, and there is no errors in console log
https://codepen.io/m_zifah/pen/MrPZZO?editors=1010
@ehutchllew hmm
ehutchllew
@ehutchllew
@zifahm ugh i figured it out
i'm so dumb, forgot about it.
Stephen James
@sjames1958gm
@zifahm Your maps need return if you use {} for arrow functions
ehutchllew
@ehutchllew
@sjames1958gm tried with return as well, nothing. I did this and it worked:
_getRecipeTitles(){
    let arr = [];
    this.state.recipes.forEach((item) => {
      arr.push(<h1>{item.title}</h1>)
    });
    return arr;   
  }
I forgot that react renders elements/components in arrays.
Muhammed Hafiz
@zifahm
@sjames1958gm @ehutchllew ohhh
return
Stephen James
@sjames1958gm
@zifahm If you use () then it automatically returns
Muhammed Hafiz
@zifahm
@sjames1958gm @ehutchllew thank you so much guys
CamperBot
@camperbot
zifahm sends brownie points to @sjames1958gm and @ehutchllew :sparkles: :thumbsup: :sparkles:
api offline
:star2: 8865 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
ehutchllew
@ehutchllew
@zifahm did it work with just a return or did it require an array as well?
Muhammed Hafiz
@zifahm
ehutchllew
@ehutchllew
sweet
Muhammed Hafiz
@zifahm
:)
Stephen James
@sjames1958gm
@zifahm I forget that often, so I saw it pretty quickly :)
Muhammed Hafiz
@zifahm
@sjames1958gm :)
dinesh
@1532j0004kg
hi james
yogiwhocodes
@yogiwhocodes
Hi everyone, just discovered this chat here and don't know if this is the right place to ask... I'm working on the random quote machine and I'm stuck with my twitter button. I wanna use the .attr method to push the quote into the twitter 'data-text' field but can't figure out how to implement it. Could somebody maybe help me out there? This is my codepen (please ignore the design!) https://codepen.io/yogiwhocodes/pen/ZvOmyd
Ken Haduch
@khaduch
@yogiwhocodes - hello. Not sure about the twitter button just yet, but looking at the page. One suggestion - get a quote to populate your quote box or put some text in there to begin with - maybe a favorite quote? And something like "Click the button for new quotes"... ?