Skip to content

Conversation

viskosa
Copy link
Collaborator

@viskosa viskosa commented Sep 1, 2018

No description provided.

activePage: 'homePage',
inputValue: '',
newItems: [],
willBePurchased: [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so optimistic naming :)
You know almost 70% declines happens at shopping-cart

isButton: false
})*/
let item = event.target.previousElementSibling.textContent;
this.state.willBePurchased.push(item);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please not mutate the state

if (!this.state.inputValue) {
return;
};
this.state.newItems.push(this.state.inputValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not mutate the state :(

return;
};
this.state.newItems.push(this.state.inputValue);
this.setState({inputValue: ''});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's much better to write it that way:

const newItems = [...this.state.newItems, this.state.inputValue]
this.setState({
 newItems,
 inputValue: ''
})

}
/*
buyItemFromCart = (event) => {
let item = event.target.previousElementSibling.textContent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope to see PR without commented code. If someone would try to review the code, commented parts would confuse


export class OneItemBlock extends Component {
render() {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove blank lines

const {value} = this.props;

return (
<li className="list-group-item">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix formatting

render() {
const {buyItem} = this.props;
return (
<a href="#" className="btn btn-primary" onClick = {buyItem}>Buy</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix formatting

import React, {Component} from 'react';

export class PlainButton extends Component {
render() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could create 1 button for handle "success" and disable state

return (
<React.Fragment>
<button className="btn btn-light" disabled>Buy</button>
<h3 className="text-success">✓✓✓✓✓</h3>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure such label should be passed via this.props.children.

At the moment you button is not only a button. It's Button + Icon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants