Es 6 class定義プロパティフック

1560 ワード

import { Card, Icon } from 'antd';
import React from 'react';

class InfoData extends React.Component {
    //  
    // alias
    // name <=> title
    // html_url <=> rel
    // description 
    // stargazers_count <=> stars
    // created_at <=> created
    // updated_at <=> updated
    // pushed_at <=> pushed
  constructor(
    title, language,
    forks, stars,
    rel, description,
    created, updated, pushed) {
    super();
    this.title = title;
    this.language = language;
    this.forks = forks;
    this.stars = stars;
    this.rel = rel;
    this.description = description;
    this.created = created;
    this.updated = updated;
    this.pushed = pushed;
  }
  set created(created) { this._created = created; }
  get created() {
    return ` :${this._created}`;
  }
  set updated(updated) { this._updated = updated; }
  get updated() {
    return ` :${this._updated}`;
  }
  set pushed(pushed) { this._pushed = pushed; }
  get pushed() {
    return ` :${this._updated - this._pushed} years ago`;
  }
  HolderView() {
    const rightpart = (
      
{this.language} {this.stars} {this.forks}
); return (

{this.description}

{this.created}

{this.updated}

{this.pushed}

); } } export default InfoData;