Giter Club home page Giter Club logo

jammming's People

Watchers

 avatar

jammming's Issues

State, Passing Props and Child Components

Great job with the React fundamentals. You update state where you should using setState. You also pass all the right props to the child. Lastly, you use the child components to render specific parts of the application. Nice work.

Summary - Meets Expectations

You did a good job on your project. You components had all the right methods in them and did what they were suppose to. Nice work on your Spotify.js file, that can definitely be challenging. Also, good work setting state, passing props and using the child components. Be careful not to mutate your state and you should be doing great. Nice job on your project.

Spotify.js

Nice job with your Spotify.js file. A lot of users get really caught up on this good job making it through. I really like the comments you added. It helps me as a reviewer understand what the code does more quickly. Also, it makes for a good reminder if you were to come back to the code after a long time passed.

Mutating State

You have this code in your App.js -> addTrack method:

  addTrack (track) {
    let newState = this.state.savedTracks
    newState.push(track)
    this.setState({ savedTracks: newState })
  }

Here, you are trying to get a new copy of state but that won't work. newState is a direct reference to this.state.savedTracks meaning anything you do to one you do to the other. Instead you want a new copy by doing either of the following:

let newState = this.state.savedTracks.slice();
let newState = [ ...this.state.savedTracks ];

Either one will do the trick. Slice returns a new array, as does the spread operator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.