• 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)
  • 相关阅读:
    03-19总结
    JS-DOM
    难题汇总,浮动,伪元素(行级),
    bug汇总
    两栏布局
    表单 form
    a 、ul、 table 标签
    Bootstrap的基本使用(css、js文件的引入)
    6. CSS样式
    5 CSS
  • 原文地址:https://www.cnblogs.com/zhx119/p/5607794.html
Copyright © 2020-2023  润新知