Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

week5_react_assignments #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

week5_react_assignments #1

wants to merge 1 commit into from

Conversation

ahmetinan79
Copy link

budget-calculator projesini de video'yu izleyerek tamamladim.
Ama klasoru cok fazla dosya oldugu icin buraya yuklenmiyor.
local ekran goruntusunu ekledim.

budget-calculator projesini de video'yu izleyerek tamamladim. 
Ama klasoru cok fazla dosya oldugu icin buraya yuklenmiyor. 
local ekran goruntusunu ekledim.
@livetoworldlife
Copy link
Contributor

budget-calculator projesini yuklemenize gerek yok @ahmetinan79.
Proje alistirmasi olmasi icin eklenmisti

Copy link
Contributor

@livetoworldlife livetoworldlife left a comment

Choose a reason for hiding this comment

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

@ahmetinan79 Bey çalışmanız egsersizlerin tüm gerekliliklerini yerine getirmiş. Elınıze sağlık. Bu şimdiye kadarkı kısımda Reactın temellerını anladığınızı gösterir.

Birkaç öneri ekledim react çalışmalarınızda bunları da dikkate alırsanız daha doğru kullanım olacağını düşünüyorum.

Çalışmalarınızda başarılar.

return <li>{props.value}</li>;
}

function HobbyList (props) {
Copy link
Contributor

Choose a reason for hiding this comment

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

HobbyList componentine eger parent componentinden(varsa) data aktarmayacaksaniz props parametresi eklemenize gerek yok.(kaldirilabilir)

function HobbyList (props) {
const hobbies = ['Surfing', 'Rock climbing', 'Mountain biking', 'Breakdancing'];
const listHobbies = hobbies.map((hobby) =>
<Hobbies key={hobby} value={hobby} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Bu aliştırmada key={hobby} düzgün çalışır. Ancak hobbies içinde aynı eleman olması ihtimaline binaen key için 3 farklı anahtar tavsiyesi verılebilir.

1- hobbies.map((hobby, index) => <Hobbies key={index} value={hobby} />
2- key={Math.random()} 
3- key={uuidv4()}   alttaki linkteki paket kullanilabilir

https://www.npmjs.com/package/uuid

function App() {
return (
<div className="App">
<div style={{
Copy link
Contributor

Choose a reason for hiding this comment

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

inline style kullanilmasi tavsiye edilmez. Çok satırlı kodlarda componenti okumayı ve anlamayı zorlaştırır.
App.css içinde style eklenebılır.
Ama böyle bir özellik varsa neden kullanılmasın?

title = {title.moneyBack}
description = {description.moneyBack}
/>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Bu şekilde 3 child components çalışıyor. Ancak react mantığı developerın işini kolaylaştırmayı amaçlar.
Mesela 3 değilde 100 olsaydı hepsını teker teker yazmak çok vakit alacaktı.

GuaranteeList gibi bir child oluşturup, map fonksıyonu kullanıp return etmenizi tavsiye ederim.

<Count/>
</div>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Grupta sorduğunuz gibi bu şekilde Counter parent component içinde Count ve Button component kullanarak
çalışabilir. Ancak dışarda kullanmak daha kullanıma uygun olacağından

      <Button onClick={clickToCount} />
      <Count count={count} />

denılerek clickToCount eventı ve count degerı Counter parent component içinde tanımlanarak
Count ve Button componentıne props gonderılerek Counter dısına alınabılır.
Aşağıdaki gibi mesela:

const Count = ({ count }) => <div className="counter">{count}</div>;

const Button = ({ onClick }) => <button onClick={onClick}>Add 1!</button>;

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.

None yet

2 participants