Coder Social home page Coder Social logo

goit-react-hw-02-feedback's Introduction

Hi there 👋

🙍 About me

  • 🔭 I’m currently working on developing an application DrawYourDreams from my portfolio.
  • 🌱 I’m currently learning JS and React.
  • 👯 I’m looking to collaborate on cooperation for a joint project with React.
  • 💬 Ask me about whatever you want.
  • 📫 How to reach me: write me on email or linkedin
  • ⚡ Fun fact:
  • I love people and I like working in a group,
  • When I was 25, I enrolled in a ballroom dancing course,
  • I love cooking and animals.

🔧 Technologies

HTML5 CSS3 Sass

JavaScript React Node.js

Git Webpack Prettier

📫 Contact Me on Social Media

Linkedin Gmail Badge

💻 Open Source Work Stats

goit-react-hw-02-feedback's People

Contributors

gosiaantoniak avatar

Watchers

 avatar

goit-react-hw-02-feedback's Issues

Project structure

import React, { Component } from "react";
import Statistics from "./components/Statistics/Statistics";
import FeedbackOptions from "./components/FeedbackOptions/FeedbackOptions";
import Section from "./components/Section/Section";
import Notification from "./components/Notification/Notification";
import "./index.css";
class App extends Component {
state = {
good: 0,
neutral: 0,
bad: 0,
};
handleFeedback = (e) => {
const { name } = e.target;
this.setState((state) => ({ [name]: state[name] + 1 }));
};
countTotalFeedback = () => {
const { good, neutral, bad } = this.state;
return good + neutral + bad;
};
countPositiveFeedbackPercentage = () => {
const { good, neutral, bad } = this.state;
return Math.round((good / (good + neutral + bad)) * 100);
};
render() {
const { good, neutral, bad } = this.state;
const actualState = this.state;
const total = this.countTotalFeedback();
const positivePercentage = this.countPositiveFeedbackPercentage();
return (
<>
<Section title="Please leave feedback">
<FeedbackOptions options={actualState} onLeaveFeedback={this.handleFeedback} />
</Section>
<Section title="Statistics">
{total ? (
<Statistics
good={good}
neutral={neutral}
bad={bad}
total={total}
positivePercentage={positivePercentage}
/>
) : (
<Notification message="There is no feedback" />
)}
</Section>
</>
);
}
}
export default App;

App może lepiej trzymać w components. Swoją drogą w components masz już App którego nie używasz, można je podmienić albo usunąć to którego nie używasz.

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.