Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"dependencies": {
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.2"
"react-scripts": "3.1.2",
"styled-components": "^4.4.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
30 changes: 30 additions & 0 deletions public/pureprofile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<html>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 파일의 정체는 무엇일까요 ??


<body>
<h1>최수민</h1>
<div>안녕하세요 저는 서강대학교의 컴퓨터공학과에 다니고 있습니다</div>안녕하세요 저는 서강대학교의 컴퓨터공학과에 다니고 있습니다</div>
<div>올해는 25살인데 내년에는 26이에요</div>
<div>지금 기분은 행복해요!</div>
<h2>좋아하는 동물</h2>
<li>사자</li>
<li>토끼</li>
<li>뱀</li>

<h1>이한길</h1>
<div>안녕하세요 저는 홍익대학교의 법학고에 다니고 있습니다.</div>
<div>올해는 29살인데 내년엔 30이에요.</div>
<div>지금 기분은 불행해요!</div>
<h2>좋아하는 동물</h2>
<li>펭귄</li>

<h1>김서영</h1>
<div>안녕하세요 저는 이화여자대학교의 사이버보안과에 다니고 있습니다.</div>
<div>올해는 22살인데 내년에는 23이에요</div>
<div>지금 기분은 불행해요!</div>
<h2>좋아하는 동물</h2>
<li>웜</li>
<li>트로이목마</li>

</body>

</html>
30 changes: 28 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import React, {Component} from 'react';
import Profiles from "./Component/Profiles";


class App extends Component {
constructor(props){
super(props);
this.state = {
members : [
{name:'최수민', school:'서강', major:'컴퓨터공학',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{ key: value } 형식으로 만든 객체를 JSON(JavaScript Object Notation) 이라고 해요.
JSON 위키 백과 링크인데 학습에 참고하시면 좋을 것 같아요.

근데 이 안에 데이터가 많아지기 시작하면 한 줄에 쓰는 것 보다 줄을 나눠서 쓰는 게 더 보기 좋아요.
자바스크립트 스타일 가이드 인데 여기 중간에 보시면 Object Rules 라는 소제목 부분을 보면 짧은 객체들은 한 줄로 압축해서 표현해도 되지만 길어지면 줄을 나눠서 표기하는 것을 추천(?)하고 있네요 😂

age:25, emotion:'행복',animal:['사자','토끼','뱀']}, //최수민 정보

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

age 를 숫자로 👏

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

모든 네이밍은 의도와 역할이 명확히 드러나도록 해주시는게 좋아요!
ex) animal -> favoriteAnimalList


{name:'이한길', school:'홍익', major:'법학',
age:29, emotion:'불행',animal:['펭귄']}, //이한길 정보

{name:'김서영', school:'이화여자', major:'사이버보안학',
age:22, emotion:'불행', animal:['웜','트로이목마']} //김서영 정보
]
}
}

render() {
return <div className="App">Hello React!</div>;

return <div className="App">

<Profiles data={this.state.members[0]}></Profiles>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<Profiles data={this.state.members[0]}></Profiles>
<Profile data={this.state.members[0]}/>
  1. 1명에 대한 정보만 담고있으니 Profile이라는 네이밍이 더 적절할 것 같아요!
  2. children이 없는 경우 self closing으로 작성해주세요~ 참고

<Profiles data={this.state.members[1]}></Profiles>
<Profiles data={this.state.members[2]}></Profiles>
Comment on lines +26 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

반복문을 이용해 보는 것은 어떨까요 ?


</div>;

}
}

export default App;
export default App;
38 changes: 38 additions & 0 deletions src/Component/Profiles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { Component } from 'react';

class Profiles extends Component {
render() {
var data = this.props.data;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

링크 를 보고 학습에 참고하면 좋을 것 같아요 ! 😁

var lists = [];

var Animals = [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

변수 네이밍 에 대하여 한번 읽어보세요 ~

var i= 0;
while (i < data.animal.length) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

while 문 말고 for 문으로 바꿔보는 것은 어떨까요?

Animals.push(<li key={data.animal[i]}>{data.animal[i]}</li>);
i = i+ 1;
}

lists.push(
<div key={data.name}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

어차피 1번만 push되기 때문에 굳이 lists 변수에 넣을 필요 없이 이 내용 그대로 return문에 써주시면 되세요!


<h1>{data.name}</h1>
<div>{`안녕하세요 저는 ${data.school}대학교의 ${data.major}과에 다니고 있습니다.`}</div>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

text는 p태그로 감싸주세요~

<div>{`올해는 ${data.age}살인데 내년엔 ${(data.age)+1}예요.`}</div>
<div>{`지금 기분은 ${data.emotion}해요!`}</div>

<h3>좋아하는 동물</h3>
{Animals}

</div>
);

return (

<article>
{lists}
</article>
);
Comment on lines +16 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 부분에 줄 바꾸기는 혹시 의도적이신가요?
불필요한 줄 바꿈을 없애서 조금 더 보기 좋게 만들어 볼까요?

}
}

export default Profiles;