Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 01 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 2019 18:04
    thecodingaviator closed #31157
  • Apr 01 2019 18:04
    thecodingaviator closed #33788
  • Apr 01 2019 18:04
    thecodingaviator commented #33788
Christopher McCormack
@cmccormack
key => key represents each item in your ingredient array
also when using arrow notation you need to either omit the curly braces to return something or add the return inside the braces.
{key => key} or {key => { return key; }
Stein-T Dale
@Lofthur
@cmccormack Will check it out. But i think this is what i have done earlier
Christopher McCormack
@cmccormack
Ah I see why you're trying to use key - when mapping you need to have a key so do something like this:
const ingredients = this.props.recipe.ingr.map(item => <li key={item}>{item}</li> );
item will have to be unique if you do it that way, else you can append something to it if you like
Stein-T Dale
@Lofthur
@cmccormack Jupp
Stein-T Dale
@Lofthur
@cmccormack I tried the code, but i still get the same error (Cannot read property 'map' of undefined)
The thing i do not understand is that i have already used map on the object earlier, to split it up into the different dishes. I can access the name and the descriptions, but the array just show this error. Hardcoding a console.log to show one item from the array works but i also get undefined (two times) in the console.
Christopher McCormack
@cmccormack
@Lofthur is it possible that it's only undefined the first time React renders your component, prior to loading the recipe?
Stein-T Dale
@Lofthur
@cmccormack Tried another console with the code you showed me, and the undefined is gone. Sorry for not trying that before...
Christopher McCormack
@cmccormack
@Lofthur in your first code I don't believe your array had anything in each position, as you had not returned anything within the map
> var arr = [1,2,3]
> arr.map(key=>{key})
[ undefined, undefined, undefined ]
> arr.map(key=> key )
[ 1, 2, 3 ]
Stein-T Dale
@Lofthur
@cmccormack Yeah that could be. ;)
@cmccormack I see that you told me about the return statement and the curly braces.
@cmccormack Thanks for the help. You got me a bit further. Have to dig into it a bit more :D
CamperBot
@camperbot
lofthur sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
yup np
Jason Luboff
@JLuboff
I wonder if they officially killed camperbot..
Tiago Correia
@tiagocorreiaalmeida
https://codepen.io/tiagocorreia/full/JyqOQm/ can someone help me? no idea why the hover on the contact button doesnt work got a nimation there
piteto
@piteto
@tiagocorreiaalmeida <a> elements are inline, so they don't have height/width, so scale() won't work. make it display: inline-block on hover as well and your scale transform should work.
actually, make it inline-block in the non-hover section...then the content next to it won't move around on hover
Stein-T Dale
@Lofthur
@cmccormack Got it to work. The thing was that i did not have the ingredients array in the other dishes. When the map function tried to go over those it returned with undefined :D
Tiago Correia
@tiagocorreiaalmeida
@piteto solved thanks
CamperBot
@camperbot
tiagocorreiaalmeida sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
no brownies for oyu
Christopher McCormack
@cmccormack
@Lofthur ahh consistency :D glad you found it
Andrew Knox
@iamknox
Screen Shot 2017-09-06 at 1.56.01 PM.png
Screen Shot 2017-09-06 at 1.57.08 PM.png
Can anyone tell me why the arrow function will leave 0 (zero the number) in the arrow but the second function takes 0 (zero) out of the array?
leave zero in the array**
Diego Mayer
@Chrono79
@iamknox
"0" == 0 //true
"0" === 0 //false
Randell Dawson
@RandellDawson
@iamknox - Because filter expects a boolean to be returned. When you return 0 in the non-arrow function version, that evaluates to false, so it is excluded.
Bryan Reese
@breese8009

Guys im trying to pull the data-styleid attribute value but having trouble...
here is the var an code im trying to get it with but gettin undefined.

let styleId = $(this).parents('.styleClass').data('styleid');

function renderStyles(style) {


    let styleHtml = `
    <!-- Style information -->

    <div class="card-header styleClass" data-styleid="${style._id}"><h1>${style.type} ${style._id}</h1></div>
        <div class="card-body">
            <p class="card-title">Description: ${style.description}</p>
            <p class="card-text">Comments: ${style.comments}</p>
            <p class="card-text"><a href="${style.link}">Wiki link</a></p>
            <div class="row">
                <div class="col-sm-2">
                    <button class="btn-danger delete-style">Delete</button>
                </div>
                <div class="col-sm-2">
                    <button class="btn-info">edit</button>
                </div>
            </div>
        </div>
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Add school</button>
    </div>

    `

    $('.styleDisplay').prepend(styleHtml);
}

```

so on click of a button, i want to console.log() the data-styleid attributes value
u would think $(this).data('styleid') would do the trick but it doesnt
piteto
@piteto
because it isn't an object @breese8009 it's a text string, so you have to use .attr()
let styleId = $(this).parents('.styleClass').attr('data-styleid');
Bryan Reese
@breese8009
@piteto still gettin undefined :(
piteto
@piteto
I think we need to see more code then to make sure this part is correct: $(this).parents('.styleClass')
Christopher McCormack
@cmccormack
@breese8009 is data-styleid="${style._id}" supposed to be a template literal? Those should use grave accents right? Or are you passing the string to use later?
Jason Luboff
@JLuboff
@cmccormack The entire thing is a template literal
so the quotes are okay
Christopher McCormack
@cmccormack
@JLuboff ah didn't see thanks
CamperBot
@camperbot
cmccormack sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
api offline
Jason Luboff
@JLuboff
I had to go double check lol
Bryan Reese
@breese8009
@cmccormack yea its a full temp literal
Tiago Correia
@tiagocorreiaalmeida
need a little help guys
$( document ).ready(function() {
    var percentage = $(".progress").attr("progress");
    console.log(percentage);
});