This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy and self modified from ys.zsh-theme, the one of default themes in master repository | |
# Clean, simple, compatible and meaningful. | |
# Tested on Linux, Unix and Windows under ANSI colors. | |
# It is recommended to use with a dark background and the font Inconsolata. | |
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | |
# http://xiaofan.at | |
# 2 Jul 2015 - Xiaofan | |
# Machine name. | |
function box_name { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://reactjs.org/docs/uncontrolled-components.html#the-file-input-tag | |
class FileInput extends React.Component { | |
constructor(props) { | |
super(props); | |
this.handleSubmit = this.handleSubmit.bind(this); | |
} | |
handleSubmit(event) { | |
event.preventDefault(); | |
alert( | |
`Selected file - ${this.fileInput.files[0].name}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
// Refs are created using React.createRef(). | |
// Refs are commonly assigned to an instance property when a component is constructed so they can be referened throughout the component. | |
this.myRef = React.createRef(); | |
} | |
render() { | |
// Refs are attached to React elements via the ref attribute | |
return <div ref={this.myRef} />; |