These are chat archives for FreeCodeCamp/HelpFrontEnd

16th
Jun 2018
roxxlen
@roxxlen
Jun 16 2018 00:37
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: ''
    };
    this.handleEnter = this.handleEnter.bind(this);
    this.handleKeyPress = this.handleKeyPress.bind(this);
  }
  // change code below this line
  componentDidMount() {
    document.addEventListener('onClick', this.handleKeyPress)    
  }
  componentWillUnmount() {
    document.removeEventListener('onClick', this.handleKeyPress)     
  }
  // change code above this line
  handleEnter() {
    this.setState({
      message: this.state.message + 'You pressed the enter key! '
    });
  }
  handleKeyPress(event) {
    if (event.keyCode === 13) {
      this.handleEnter();
    }
  }
  render() {
    return (
      <div>
        <h1>{this.state.message}</h1>
      </div>
    );
  }
};
what it will be the second argument in EventListener ?
Mois├ęs Man
@moigithub
Jun 16 2018 00:53
@roxxlen if u re-read the instructions.. onClick is not the event u want
roxxlen
@roxxlen
Jun 16 2018 01:09
...
keydown was built in ?
Ryan Williams
@Ryanwfile
Jun 16 2018 02:10
I am working on a multi level dropdown menu using Bootstrap, Jquery in React and I'm having difficulty closing one of the menu's when another one is selected, how do I go about closing an opened menu when another is selected or the user clicks away from the menus? Here is the codepen, any help is greatly appreciated.
https://codepen.io/Ryanwfile/pen/bMwYam
anthonygallina1
@anthonygallina1
Jun 16 2018 02:33
Aymen
@AymenAlSalem
Jun 16 2018 02:56
HI , I'm working on another version of Portfolio project, I have few issues with pseduo elements in line 294 & 309 , fontAwesome's icons is fliped and it won't load on smartphones :
https://codepen.io/AymenAlSalem/pen/NzaOdV
**flipped on desktop and won't load on smartphones
Ryan Williams
@Ryanwfile
Jun 16 2018 07:30
@anthonygallina1 Thank you I will have to try that
Deepak Gowda
@Deep2322_twitter
Jun 16 2018 07:44
var markers = [
                {
                    coords:{lat: 12.8789, lng: 77.6090}, 
                    icon: 'boy.png', 
                    content: '<h3>Deepak Gowda in Hulimavu</h3>'
                },
                {
                    coords:{lat: 12.9326, lng: 77.6036}, 
                    icon: 'boy.png', content: '<h3>Deepak Gowda in IBC Knowledge Park</h3>'
                },
                {
                    coords:{lat: 12.8885, lng: 77.4532}, 
                    icon: 'boy.png', 
                    content: '<h3>Deepak Gowda in Decathlon</h3>'
                }
            ]

 for( var i = 0; i < markers.length; i++) {
                addMarker(element[i]);
            }
how do i do this using forEach instead of for loop like above ?
i finding it difficult get index of array
disregard, got it
Lallo Vigil
@lalov1
Jun 16 2018 13:39
@AymenAlSalem Are you sure you added FontAwesome to the Quick Add under CSS?
Marc
@MWBauer
Jun 16 2018 13:57
Morning everyone.
Anyone good with images in JS?
Tom
@moT01
Jun 16 2018 14:25
@MWBauer whats the problem
Marc
@MWBauer
Jun 16 2018 14:30
I'm trying to use an array to pick a random image. I'm having a hard time figuring out how to call the random pic from the dir.
document.body.appendChild("C:\Devfun\ServerTests\public\" + pictures[Math.floor(Math.random() * 7)] + ".gif\">");
I was told that document.writeln won't work and shouldn't be used. console.log isn't working
and also, there's code that sometimes uses / and somtimes uses
\ for the same thing
Tom
@moT01
Jun 16 2018 15:04
you cant just append the string of a file to a document
you should have an element waiting in the dom so you can just change the src in the element or the background in the style
or you can create an element in the js and then append it
Marc
@MWBauer
Jun 16 2018 15:07
Ok. Could you help me build the element?
do you have a place I can see the project/check out the code?
you should be able to do it just like the example in that link
Marc
@MWBauer
Jun 16 2018 15:09
THank you. I will look
I was gonna' use Git but my friend who's teaching me coding and cool stuff is currently sick and says that Github is kinda' counter-intuitive
I can send you the code. copy and paste
DarkxPunk
@DarkxPunk
Jun 16 2018 15:52
Anyone particularily skilled in CSS Transform, specifically with 3D movements?
Marc
@MWBauer
Jun 16 2018 16:07

can I use ```

var img = new Image(1,1); // width, height values are optional params
img.src = 'http://www.testtrackinglink.com';

```

with arrays?
lol
Tom
@moT01
Jun 16 2018 16:13
the three ticks need to be on their own line
getting anywhere?
Marc
@MWBauer
Jun 16 2018 16:14
that's why I loled. I realized what I did after I sent it.


var img = new Image(1,1); // width, height values are optional params 
img.src = 'http://www.testtrackinglink.com';
Can I use var img=new Image[imgarray] ?
Tom
@moT01
Jun 16 2018 16:15
what - wrong url?
Marc
@MWBauer
Jun 16 2018 16:16
This was just a copy of what was in the link you sent.
I'm trying to change ut
Marc
@MWBauer
Jun 16 2018 16:19
Ok. Great. Now, do you have strut assemblies for a 20002 Honda Civic Si?
lol
Tom
@moT01
Jun 16 2018 16:20
yes
Marc
@MWBauer
Jun 16 2018 16:21
I wish you did. THat would be great
Tom
@moT01
Jun 16 2018 16:21
send me 100$ and ill ship it to you
Marc
@MWBauer
Jun 16 2018 16:21
Just ne?
one?
Marc
@MWBauer
Jun 16 2018 16:29
Where you put 'src' am I putting in the string for my image folder?
ya 'know what...nvm
Just looked at it again.
I'm horribly divided today.
Listening to music, play 2 different games, coding, shopping for car parts...
Marc
@MWBauer
Jun 16 2018 16:36
Ok. So I put in your code, but it still isn't displaying.
Tom
@moT01
Jun 16 2018 16:44
lets see your code
Marc
@MWBauer
Jun 16 2018 16:52
You've got pm
Marc
@MWBauer
Jun 16 2018 20:08
I'm currently trying to look at my sample.html to figure out what I need to do
Bjorn van de Peut
@bjorno43
Jun 16 2018 21:39
@MWBauer What is it you want to do?
Simon Cordova
@gbsimon87
Jun 16 2018 21:47
Hey all.
Anybody have a good resource, apart from the docs, that teaches how to correctly lift the state up in React?
Corey Lewis
@cursiv3
Jun 16 2018 22:41
By "lift the state up" do you mean pass changes from children up to a parent with state?
Alexander R Bott
@Abott1222
Jun 16 2018 23:10
@gbsimon87 if you got a question about the tutorial we might be able to help but idk any specific tutorials that cover that besides the docs