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
[alias] | |
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
lg = !"git lg1" |
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
inputOnChange = propName => ev => this.setState({ [propName] : ev.target.value }) | |
render () { | |
return ( | |
<form onSubmit={this.handleLogin} > | |
<input | |
type='input' | |
value={this.state.user} | |
placeholder='username' | |
className='header-login-input' |
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
function WarningBanner(props) { | |
if (!props.warn) { | |
return null; | |
} | |
return ( | |
<div className="warning"> | |
Warning! | |
</div> | |
); |
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
function SplitPane(props) { | |
return ( | |
<div className="SplitPane"> | |
<div className="SplitPane-left"> | |
{props.left} | |
</div> | |
<div className="SplitPane-right"> | |
{props.right} | |
</div> | |
</div> |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import PropTypes from 'prop-types'; | |
import './App.css' | |
//const App = () => <h1>Hello stateless</h1> | |
class App extends React.Component { | |
constructor() { | |
super(); |
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
import React from 'react'; | |
import { BrowserRouter as Router, Link, Route } from 'react-router-dom'; | |
import Footer from './Footer'; | |
import Header from './Header'; | |
import Todos from './Todos'; | |
import Articles from './Articles'; | |
export default class Layout extends React.Component { | |
constructor() { | |
super(); |
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
// Calls the children callback numTimes to produce a repeated component | |
function Repeat(props) { | |
let items = []; | |
for (let i = 0; i < props.numTimes; i++) { | |
items.push(props.children(i)); | |
} | |
return <div>{items}</div>; | |
} | |
function ListOfTenThings() { |
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
import PropTypes from 'prop-types'; | |
MyComponent.propTypes = { | |
// You can declare that a prop is a specific JS primitive. By default, these | |
// are all optional. | |
optionalArray: PropTypes.array, | |
optionalBool: PropTypes.bool, | |
optionalFunc: PropTypes.func, | |
optionalNumber: PropTypes.number, | |
optionalObject: PropTypes.object, |
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
function CustomTextInput(props) { | |
return ( | |
<div> | |
<input ref={props.inputRef} /> | |
</div> | |
); | |
} | |
class Parent extends React.Component { | |
render() { |
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
const PropTypes = require('prop-types'); | |
class MediaQuery extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {type:'desktop'}; | |
} | |
getChildContext() { | |
return {type: this.state.type}; |
OlderNewer