Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

React组件写法的讨论

$
0
0

目前我遇到的写法有:

const App=React.createClass({render()}); class App extends React.Component{…}; const App=()=>(); 前面二种我都知道,就是第三种是什么鬼,哪位大神给我讲解一下,

import React from 'react';
import { Link } from 'react-router';

const Photo=({post})=>(
  <figure className="grid-figure">
    <div className="grid-photo-wrap">
      <Link to={'/view/${post.code}'}>
         {post.caption}
      </Link>
    </div>
  </figure>
);

export default Photo;

上面的代码是怎么的解构赋值法 this.props跑哪去了???


Viewing all articles
Browse latest Browse all 14821

Trending Articles