These are chat archives for FreeCodeCamp/HelpFrontEnd

22nd
Sep 2018
Tom
@moT01
Sep 22 2018 00:27
yes, you can have two classes @AJ-Brommy
Nathan Hannig
@nathanhannig
Sep 22 2018 00:55

For https://learn.freecodecamp.org/front-end-libraries/redux/use-the-spread-operator-on-arrays

Anyone know why this doesn't pass
return [...state].push(action.todo)

But this does
return [...state, action.todo]

Brad
@bradtaniguchi
Sep 22 2018 00:58
@nathanhannig when you return [].push(), your returning what push returns
which is 1 (yea its stupid)
Nathan Hannig
@nathanhannig
Sep 22 2018 01:39
ahh thanks!
that is right, totally forgot that :O
good reminder
Brad
@bradtaniguchi
Sep 22 2018 02:03
np :D
Ellyria
@Ellyria
Sep 22 2018 19:29
Hey there, I've encountered some odd CSS behavior that I don't understand. I created an example page containing three main parent elements - a header, a form, and a footer. Each of them contain child elements. Each of the three main elements have been given zero top and bottom margins and zero padding. I don't understand why enabling a CSS rule that gives the h1 or p child elements a margin of more than zero affects the margin of their parent elements, causing the header and/or footer to be set apart from the form rather than nestled right up against it as they are when I don't do that. I've put the example code into Codepen at https://codepen.io/Ellyria/pen/VGNPBK in case anyone wants to play around with it.
AJ Brommy
@AJ-Brommy
Sep 22 2018 22:41
HEy @Ellyria , I've had some similar issues with margins, and somebody pointed me to look at "collapsible margins". It sounds like it could be this that is what you are missing? https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing - good luck - let me know how you get on :)
By the way, too all those who have helped me, and whoever may be interested, I completed the Responsive Web Design section today and now have my certificate. I really want to thank the peeps here, especially those who have helped me. Thank you :)
AJ Brommy
@AJ-Brommy
Sep 22 2018 23:05
@Ellyria if you give the form element a padding of 1em and the p a margin of 1em. you may like the results? i'm not sure if that is technically the correct way to do it. but it works for me. but the link i sent will help with understanding that.