Class for creating a object that can easily be called for the html implicit to the object type

This commit is contained in:
2017-06-02 19:37:58 +02:00
parent 30dd05ebf3
commit 47269ebc70

View File

@@ -0,0 +1,22 @@
import React from 'react';
class MovieObject {
constructor(object) {
this.id = object.id;
this.title = object.title;
this.year = object.year;
// Check if object.poster != undefined
this.poster = 'https://image.tmdb.org/t/p/w150' + object.poster;
}
getElement() {
var returnString = [
<p>{this.title} ({this.year})</p>,
<img src={this.poster}></img>,
<br></br>
]
return returnString;
}
}
export default MovieObject;