Coder Social home page Coder Social logo

redux-delete-lab's Introduction

Set List Lab - Redux Delete

Objectives

  1. Remove responsibility for rendering bands from the BandsContainer by creating Bands and Band components.
  2. Implement a delete button for each band, such that the store is appropriately updated.

Overview

Well all things change, and sometimes that means that even our favorite bands break up and we must remove all evidence of them. We want an application that allows us to remove specific bands, and have those changes reflected in our store's state and on the page.

We are starting off with our work from the previous lab, a React/Redux app that allows us to create new band elements and displays them on the page. In order to maintain separation of concerns, we have removed the code from BandsContainer that renders the bands to the page.

Instructions

The BandInput component is already set up for you and BandsContainer is partially working, but take a moment to review the flow of information. The BandsContainer is connected to Redux and has passed the addBand action to props. addBand is then passed as props to BandInput so the action can be dispatched when a new band is submitted.

  1. Create a new Band component that will be in charge of displaying the information for a single band.

  2. Create a new Bands component that will handle the rendering of the Band components from a list of bands provided as props.

  3. Use BandsContainer to access the Redux store using the provided mapStateToProps method. Pass the bands obtained from the store into the Bands component.

  4. Currently, bands are stored in state as an array of strings representing the name of each band. In the manageBand reducer, change the structure of the state such that each band is an object with id and name properties; be sure to assign each band its own unique ID on creation. The array of objects will be available to BandsContainer through mapStateToProps and will need to be passed as props through Bands to each rendered Band component.

  5. In the Band component, you will need to add a button that dispatches an action of type 'DELETE_BAND' and passes through that band's id as the action.id. This dispatched action should be provided as a prop from BandsContainer.

  6. Finally, you will need to add code to handle the DELETE_BAND action in the reducer. When a band's delete button is pressed, it will return a new list of bands that does not include the deleted band.

redux-delete-lab's People

Contributors

dependabot[bot] avatar ihollander avatar jeffkatzy avatar lizbur10 avatar lukeghenco avatar maxwellbenton avatar nikymorg avatar rrcobb avatar vibraniumforge avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redux-delete-lab's Issues

Wrong Attribute: Line 29 in BandInput.js

It should be ...value = {this.state.bandName} not ...{this.state.text} as there's no such attribute in the state. This then allows automatic clearance of the input box every time a band name is submitted.

Missing a space

Need a space before the opening parenthesis in this sentence:
"You will also need to pass through the band object(this should include the id and name of the band) as the props to each rendered Band component."

Thank you.

Bad Tests

The last couple tests only work if you are using 'this.props.band.id' in the dispatch function, but in the lesson before this, it has you passing the 'id' individually as a prop, and then passing 'this.props.id' into the dispatch function. Both function in browser the same way, but tests should reflect the way we are taught to do things.

Test are out of sync

@aturkewi @Lukeghenco
Test are out of sync - batch 000 (full stack with react)
https://github.com/learn-co-students/redux-delete-lab-v-000/blob/master/test/index-test.js

learn-co-curriculum
https://github.com/learn-co-curriculum/redux-delete-lab/blob/master/test/index-test.js

On line 94 of the test in the batch 000 it is passing text and id in the component as props, when in the lesson it states to pass in band={band} as props. They can pass it by reading the test. But it puts the lesson out of sync with the test.

Tests using different data types

Hi!

Quick note:

Some of the tests in this lab are using a band array that look like:

[ "Gwar", "Dimmu Borgir", "Ashe", "Clairo" ] (okay I'll stop using this to list good artist names)

But some of them use a bands array that looks like:

[
  { id: 1, name: "Finneas" },
  { id: 2, name: "Caspian" },
]

In the solution, the bands array getting passed to test the component looks completely different; it's passing some kind of Symbol component out of a React library that has a huge number of properties.

Please correct the tests in the master branch!

Wrong Code, Suggestion

BandInput's input element has a value of this.state.text but it should be this.state.bandName.

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.