Random Quote Machine feedback, thanks!

Random Quote Machine feedback, thanks!
0

#1

Just finished (I hope) my Random Quote Machine and I was looking for some feedback, not only in terms of design (which is pretty much the same as the example) but also in terms of coding. Thanks!

Random Quote Machine


#2

In terms of coding I think it’s really good, I think the component structure and use of state makes sense.

In my opinion the handleClick in the Container component is doing a lot and it would be more readable to break it up into smaller methods, and call them from within handleclick.

One cool trick you can use when you find yourself writing this.state or this.props a bunch in the jsx is to destructure variables from the state or props using object destructuring.

For example, a render might look something like this:

  render() {
    const {quote, author, color} = this.state;
    return (
      <div id="quote-box" style={{ background: color }}>
          <p>{quote}</p>
          <p>{author}</p>
      </div>
    );
  }