-
Notifications
You must be signed in to change notification settings - Fork 35
3week HW #74
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
base: 3week
Are you sure you want to change the base?
3week HW #74
Conversation
|
|
||
| export default class Game extends Component { | ||
|
|
||
| constructor(props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state를 사용하기 위한 방법으로 constructor에서 사용할수도 있지만
class property initializers를 이용해서 좀더 간단하게 state를 선언 하실수도 있습니다!
https://react.christmas/2017/17
ex) state = { fullcontent: {}, contents: []}
| const maxResultSize = 21 | ||
| const token = 'AIzaSyA2oEpIi9JSjjUk4_0zxcBfDg8iscuJXzs' | ||
| axios.get( | ||
| 'https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
문자열과 변수를 혼용해야 할때
Template literals이라는 문법을 사용해서 사용가능합니다!
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals
ex) https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular&videoCategoryId=${categoryIdOfGaming}&key=${token}&maxResults=${maxResultSize}
| constructor(props) { | ||
| super(props); | ||
| this.state = { | ||
| fullContent: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fullContent 는 사용하지 않는 state이므로 삭제 해주시면 좋을것 같습니다!
| setContents = (data) => { | ||
| let list = [] | ||
| data.items.forEach((item, index) => { | ||
| console.log({...item}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
숙제긴 하지만 평소에 불필요한 console.log를 지워주시는 습관을 들이시면 좋습니다
3주차 과제입니다. /youflix-hw3 디렉토리를 확인하시면 됩니다.