text: import React, { Component } from 'react';
  import Section from './Section/Section';
  import Statistics from './Statistics/Statistics';
  import FeedbackOptions from './FeedbackOptions/FeedbackOptions';
  import Notification from './Notification/Notification';
  
  export default class App extends Component {
    state = {
      good: 0,
      neutral: 0,
      bad: 0,
    };
  
    handleIncrement = ({ target }) => {
      const { name } = target;
      this.setState(prevState => ({
        [name]: prevState[name] + 1,
      }));
    };
  
    countTotalFeedback = () => {
      const likes = Object.values(this.state);
      const totalfeedback = likes.reduce((acc, value) => acc + value, 0);
      return totalfeedback;
    };
  
    countPositiveFeedbackPercentage = () => {
      const { good } = this.state;
      return good < 1 ? 0 : Math.round((good * 100) / this.countTotalFeedback());
    };
  
    render() {
      const { good, neutral, bad } = this.state;
  
      return (
        <div>
          <Section title="Please leave feedback">
            <FeedbackOptions onLeaveFeedback={this.handleIncrement} />
            {this.countTotalFeedback() > 0 ? (
              <Statistics
                good={good}
                neutral={neutral}
                bad={bad}
                total={this.countTotalFeedback()}
                positivePercentage={this.countPositiveFeedbackPercentage()}
              />
            ) : (
              <Notification message="No feedback given" />
            )}
          </Section>
        </div>
      );
    }
  }
  