Code Monkey home page Code Monkey 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

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.