zoukankan      html  css  js  c++  java
  • react ES5 与ES6的写法

    ES5
    var React = require('react'); var ReactDOM = require('react-dom'); // 定义组件 var HelloMessage = React.createClass({ render: function() { return <div> React,我们来了... </div>; } }); // 组件渲染 ReactDOM.render(<HelloMessage />, rootElement);


    ································································································
    ES6
    import React, { Component } from 'react';
    import { render } from 'react-dom';
    
    // 定义组件
    class SimpleComponent extends Component {
      render(){
        return <div> React,我们来了... </div>;
      }
    }
    
    // 组件渲染
    render(<HelloMessage />, rootElement);
    `````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
    React.js

    React.Children: Object
    React.Component: ReactComponent(props, context, updater)
    React.DOM: Object
    React.PropTypes: Object
    React.cloneElement: (element, props, children)
    React.createClass: (spec)
    React.createElement: (type, props, children)
    React.createFactory: (type)
    React.createMixin: (mixin)
    React.

    ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
    Component API


    this.context: Object
    this.props: Object
    this.refs: Object
    this.state: Object
    this.setState: Object

    ······························································································································

    react-dom.js

    ReactDOM.findDOMNode: findDOMNode(componentOrElement)
    ReactDOM.render: ()
    ReactDOM.unmountComponentAtNode: (container)
  • 相关阅读:
    django基础之ORM基础知识
    Centos7 搭建sonarQube
    centos7安装部署SVN
    centos7.5 SVN 搭建
    centos 7 部署 zookeeper
    centos7 发送邮件
    Centos7安装配置Gitlab-CE
    openldap 双主模式部署
    K8s一键安装
    ELK实战部署
  • 原文地址:https://www.cnblogs.com/zhx119/p/5607794.html
Copyright © 2011-2022 走看看