These are chat archives for FreeCodeCamp/HelpFrontEnd

26th
Sep 2018
Nicolas Ramirez
@kamatheuska
Sep 26 2018 00:12
me!
if you want more hit me up or need help lmk. Only use array.prototype.methods!!!
Supra01
@Supra01
Sep 26 2018 05:02
Anyone familiar with react and forms?
import React, { Component } from 'react';
import { Link } from 'react-router-dom';

class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {
      email: '',
      password: ''
    };
  }
  handleChange(event) {
    this.setState = ({
      email: event.target.value,
      password: event.target.value
    })
  }
  handleSubmit(event) {
    console.log(this.state)
    event.preventDefault();
  }
  render() {
    return (
      <div className="container">
        <h3>Login to...</h3>
        <div className="row">
          <form className="col s12" onSubmit={event => this.handleSubmit()}>
            {/* ---password--- */}
            <div className="row">
              <div className="input-field col s12">
                <input id="password" type="password" className="validate"
                  value={this.state.password} onChange={event => this.handleChange(event)} />
                <label htmlFor="password">Password</label>
              </div>
            </div>
            {/* ---e-mail--- */}
            <div className="row">
              <div className="input-field col s12">
                <input id="email" type="email" className="validate" value={this.state.email} onChange={event => this.handleChange(event)} />
                <label htmlFor="email">Email</label>
              </div>
            </div>
            {/* ---Submit--- */}
            <button className="btn right col s12" type="submit" name="action">Submit</button>
          </form>
        </div>
        <div>
          <p>Need an account?<Link to="/signup"> Sign Up</Link></p>
        </div>
      </div>
    );
  }
}

export default Login;
I can't seem to get my handle change function to work
abraham anak agung
@padunk
Sep 26 2018 07:08
@Supra01 you have '=' on your setState. Delete it.
Supra01
@Supra01
Sep 26 2018 07:19
@padunk I'll give it try Thank you!
Christopher
@bradley1492
Sep 26 2018 07:49
@cmccormack @jcolborn-dropdeadgames thanks for your answers on the font, I guess I‘ll use a google font then.
Nicolas Ramirez
@kamatheuska
Sep 26 2018 10:03
@marcusp619 Sorry man, it was 2am here already :)
Neil
@NNeil1
Sep 26 2018 18:00

Can anyone help me out with soemthing. I have this site: https://kids-magazine.com/produit/panier-test/ and I am trying to change "SUBSCRIPTION" to "It looks Good" via jQuery. This is what I have :

$ (".categorie-header-inner").replaceWith.("<h1>It Looks Good</h1>"); ---- However this isn't working. I'm I using replaceWith wrong?

I even tried changing it via Console, and I get syntax error
Christopher McCormack
@cmccormack
Sep 26 2018 18:11
@NNeil1 why do you have a . after replaceWith?
Neil
@NNeil1
Sep 26 2018 18:18

Typo, here is what I have in my JS file :

$ (".categorie-header-inner").replaceWith("<h1>It Looks Good</h1>");

Christopher McCormack
@cmccormack
Sep 26 2018 18:21
@NNeil1 did you actually import jquery?
@NNeil1 you also have that class in two different places
Neil
@NNeil1
Sep 26 2018 18:24
I had an error when calling Jquery, thanks for that @cmccormack
Christopher McCormack
@cmccormack
Sep 26 2018 18:26
@NNeil1 using JavaScript without jquery - document.getElementsByClassName('categorie-header-inner')[0].innerHTML = '<h1>It Looks Good</h1>'
Julian Philip Hernandez
@jpdhernandez
Sep 26 2018 19:00
Hi i need help with suppressing deprication warnings when doing an ng build does anyone know how?
Eric Weiss
@eweiss17
Sep 26 2018 19:36
could use some suggestions to code formatting (to avoid spaghetti code)
if (true) 
   if(cond_1)
       //functionality
   else if( cond_2)
      //functionality
else if (false)
   if(cond_1)
      //functionality
   else if(cond_2)
      //functionality
it feels so spaghetti to me, is there a better way to format this?
cond_1 and cond_2 are equivalent throughout
Brad
@bradtaniguchi
Sep 26 2018 20:15
are the conditions actually true and false? @eweiss17
if so your else if would never fire. Now if thats just an oversite id say split up the functionality that is the same into a seperate function.
Eric Weiss
@eweiss17
Sep 26 2018 20:18
it's if a boolean variable is true
such as
if ($unused_username) {

}
where unused_username is defined as true or false depending on factors previously in the code
I was going to split it up into a function
but so many variables defined outside these statements were affected by the functionality within
It's a script that was created in 2008...... I think it will just have to be refactored in the future
Brad
@bradtaniguchi
Sep 26 2018 20:22
So the line of code is not actualy else if (false) right?
also if theres no brackets, you can use a ternary operator instead, but id add brackets just to make things more clear, since nested ternaries can get nasted without proper formatting
Christopher McCormack
@cmccormack
Sep 26 2018 20:29
@eweiss17 is the context a function? If so, I tend to like to take my failure cases and put them near the top, and just return something if failed, else continue on
Eric Weiss
@eweiss17
Sep 26 2018 20:33
i was trying to pseudocode the block above
it's in php which i know people hate
Brad
@bradtaniguchi
Sep 26 2018 20:34
haha anyone that actually wants to help wont bash PHP
Eric Weiss
@eweiss17
Sep 26 2018 20:34
essentially the only difference between the code blocks are
which email to use, email or email2
glitz20
@glitz20
Sep 26 2018 20:35
@sabin20
anybody who can help me with css text animation?
https://codepen.io/sabin20/pen/vzMZgG?editors=1100
how can stop the animation at last sentence "UX is for everyone"?
Eric Weiss
@eweiss17
Sep 26 2018 20:36
It's harder to describe without actually involving the exact details
glitz20
@glitz20
Sep 26 2018 21:08
@eweiss17 any idea about css animation?
it was hinted by your own background css properties
glitz20
@glitz20
Sep 26 2018 21:22
@MelMacaluso what did you change?
looks awesome
thank you
Mel Macaluso
@MelMacaluso
Sep 26 2018 21:22
Didn't change much mate
Jill Lee
@jill-lee
Sep 26 2018 21:43
I know I'm in the wrong room but maybe someone can help me. My friend forgot her folder password. Her pw was saved on her old laptop. It's gone now. Need help unlocking it.
Tom
@moT01
Sep 26 2018 22:04
her folder on your laptop?
@jill-lee
Jill Lee
@jill-lee
Sep 26 2018 22:12
@moT01 I have her hard disk
Tom
@moT01
Sep 26 2018 22:18
the hard drive from the laptop? and the laptop is gone
Jill Lee
@jill-lee
Sep 26 2018 22:22
@moT01 she got the files and saved it to an external hard drive and transferred it to her new laptop.
Tom
@moT01
Sep 26 2018 22:25
so you can plug it into usb? and it shows up on the computer?
the external
Jason Luboff
@JLuboff
Sep 26 2018 22:32
@jill-lee You shouldn't need a password unless its encrypted..
Elias Curran
@eliascurran
Sep 26 2018 23:22
can someone help me with this fcc challenge, its supposed to increase the item count every time i click the button, but it doesn't.
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      itemCount: 0
    };
    // change code below this line
this.addItem = this.addItem.bind(this);
    // change code above this line
  }
  addItem() {
    this.setState({
      itemCount: this.state.itemCount + 1
    });
  }
  render() {
    return (
      <div>
        { /* change code below this line */ }
        <button onclick = {this.onclick.bind(this)}>click me</button>

        { /* change code above this line */ }
        <h1>Current Item Count: {this.state.itemCount}</h1>
      </div>
    );
  }
};
Jason Luboff
@JLuboff
Sep 26 2018 23:30
@eliascurran Your onclick is incorrect, it should be calling addItem
Also... its onClick not onclick
Elias Curran
@eliascurran
Sep 26 2018 23:33
thanks @JLuboff , that fixed it
Jason Luboff
@JLuboff
Sep 26 2018 23:34
:thumbsup: