File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11import React , { Component } from "react" ;
2+ import { Container , Button } from "react-bootstrap" ;
23
34class Companies extends Component {
45 render ( ) {
@@ -7,16 +8,26 @@ class Companies extends Component {
78 const companyName = this . props . companies . map ( company => company ) ;
89
910 return (
11+ < Container >
1012 < div >
1113 { companyName . map ( ( companynames , index ) => {
1214 return (
1315 < p key = { index } >
16+ < Button
17+ onClick = { ( ) => this . props . deleteCompany ( companynames . id ) }
18+ >
19+ { " " }
20+ DELETE{ " " }
21+ </ Button > { " " }
22+
23+
1424 Company Name: { companynames . companyname }
1525 < br /> Company id#:{ companynames . id }
1626 </ p >
1727 ) ;
1828 } ) }
1929 </ div >
30+ </ Container >
2031 ) ;
2132 }
2233}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React, { Component } from "react";
22import { connect } from "react-redux" ;
33import Companies from "../components/companies" ;
44import { bindActionCreators } from "redux" ;
5- import { fetchCompanies } from "../redux/actions/companyActions" ;
5+ import { fetchCompanies , deleteCompany } from "../redux/actions/companyActions" ;
66
77class CompanyContainer extends Component {
88 componentDidMount ( ) {
@@ -12,7 +12,7 @@ class CompanyContainer extends Component {
1212 render ( ) {
1313 return (
1414 < div >
15- < Companies companies = { this . props . companies } />
15+ < Companies companies = { this . props . companies } deleteCompany = { this . props . deleteCompany } />
1616 </ div >
1717 ) ;
1818 }
@@ -28,7 +28,7 @@ const mapStateToProps = state => {
2828const mapDispatchToProps = dispatch =>
2929 bindActionCreators (
3030 {
31- fetchCompanies
31+ fetchCompanies, deleteCompany
3232 } ,
3333 dispatch
3434 ) ;
You can’t perform that action at this time.
0 commit comments