Conversation
| previews: [], | ||
| searchOpts: { | ||
| maxResults: 10, | ||
| key: 'AIzaSyC1ORL6Y3zxvLLev6QHUqP8eF1hFbYo1WI', |
There was a problem hiding this comment.
the key is not a part of a state
| activeVideo : {} | ||
| } | ||
| this.updateSearch = this.updateSearch.bind(this); | ||
| this.getPreviews = this.getPreviews.bind(this); |
There was a problem hiding this comment.
you don't need to bind instance methods
|
|
||
| return ( | ||
| <div className="video-detail col-md-8"> | ||
| {console.log(linkToVideo)} |
There was a problem hiding this comment.
not sure you need a console.log in jsx
| import React, { Component } from "react"; | ||
| import {VideoPreview} from "./video_preview"; | ||
|
|
||
| const renderPreviews = (previews,activatePreview) => { |
There was a problem hiding this comment.
just a prototype method is fine, an additional function is a bit overhead
| render () { | ||
| const preview = this.props.preview; | ||
| return ( | ||
| <li className="list-group-item" onClick={() => this.props.activatePreview(preview)}> |
There was a problem hiding this comment.
it's better to create an instance method which would be responsible for click instead of doing it inside JSX.
You current JSX would create new function every time if components renders
| <iframe title="random" src={linkToVideo}/> | ||
| </div> | ||
| <div className="details"> | ||
| <div>{video.title}</div> |
There was a problem hiding this comment.
please extract title, description, id from props
| super(); | ||
| this.state = { | ||
| previews: [], | ||
| searchOpts: { |
There was a problem hiding this comment.
searchOpts is not a part of a state, they could be static and refers only to API
| searchOpts: { | ||
| maxResults: 10, | ||
| key: 'AIzaSyC1ORL6Y3zxvLLev6QHUqP8eF1hFbYo1WI', | ||
| videoEmbeddable: true, |
There was a problem hiding this comment.
I haven't found any place where you use videoEmbeddable, is it required ?
| key: 'AIzaSyC1ORL6Y3zxvLLev6QHUqP8eF1hFbYo1WI', | ||
| videoEmbeddable: true, | ||
|
|
||
| type:"video" |
| } | ||
|
|
||
| getPreviews = () => { | ||
| Search(this.state.searchText, this.state.searchOpts, (err, results) => { |
There was a problem hiding this comment.
I would split request and request handlers to different methods, but it's okey.
работает Utube