Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Last active February 19, 2020 16:07
Show Gist options
  • Save xgqfrms-GitHub/0a02e84d25cfeeb60d3c71e2a8ff1e91 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/0a02e84d25cfeeb60d3c71e2a8ff1e91 to your computer and use it in GitHub Desktop.
react es6 skeleton jsx

react es6 skeleton

// es6 new
import React { Component } from 'react';
import styles from "./style.css";

class XyzComponent extends Component {
    constructor(props) {
        super(props);
        this.methods = this.methods.bind(this);
        this.focus = this.focus.bind(this);
    }
    render() {
        // Use the `ref` callback to store a reference to the text input DOM
        // element in an instance field (for example, this.textInput).
        return (
            <div>
                <input
                    type="text"
                    ref={(input) => { this.textInput = input; }}
                />
                <input
                    type="button"
                    value="Focus the text input"
                    onClick={this.focus}
                />
            </div>
        );
    }
}

export default XyzComponent
@xgqfrms-GitHub
Copy link
Author

DOM

import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import HelloWorld from 'react-npm-skeleton';

class App extends Component {
    constructor(props){
        super(props);
    }
    render() {
        return(
            <div>
                <HelloWorld />
            </div>
        );
    }
}

ReactDOM.render(<App />,document.querySelector('#app'));

@xgqfrms-GitHub
Copy link
Author

@xgqfrms-GitHub
Copy link
Author

@xgqfrms-GitHub
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment