Skip to content

3week HW#74

Open
ksh0323a wants to merge 3 commits into
yesjin-git:3weekfrom
ksh0323a:3week
Open

3week HW#74
ksh0323a wants to merge 3 commits into
yesjin-git:3weekfrom
ksh0323a:3week

Conversation

@ksh0323a
Copy link
Copy Markdown

3주차 과제입니다. /youflix-hw3 디렉토리를 확인하시면 됩니다.


export default class Game extends Component {

constructor(props) {
Copy link
Copy Markdown

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' +
Copy link
Copy Markdown

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: {},
Copy link
Copy Markdown

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})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

숙제긴 하지만 평소에 불필요한 console.log를 지워주시는 습관을 들이시면 좋습니다

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.

2 participants